Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexander Lobas
2012-03-06 18:32:57 +04:00
142 changed files with 27081 additions and 1543 deletions
+1
View File
@@ -161,6 +161,7 @@ libraryLicense(name: "Android SDK Tools JPS", libraryName: "android-sdk-tools-jp
libraryLicense(name: "Apache Commons BeanUtils", libraryName: "commons-beanutils.jar", version: "1.6", license: "Apache 2.0", url: "http://commons.apache.org/beanutils/")
libraryLicense(name: "Apache Commons Codec", libraryName: "commons-codec", version: "1.3", license: "Apache 2.0", url: "http://commons.apache.org/codec/", licenseUrl: "http://commons.apache.org/license.html")
libraryLicense(name: "Apache Commons Collections", libraryName: "commons-collections", version: "3.1", license: "Apache 2.0", url: "http://commons.apache.org/collections/", licenseUrl: "http://commons.apache.org/license.html")
libraryLicense(name: "Apache Commons Discovery", libraryName: "commons-discovery-0.4.jar", version: "0.4", license: "Apache 2.0", url: "http://jakarta.apache.org/commons/discovery/", licenseUrl: "http://commons.apache.org/license.html")
libraryLicense(name: "Apache Commons HTTPClient", libraryName: "http-client-3.1", version: "3.1  (with patch by JetBrains)", license: "Apache 2.0", url: "http://hc.apache.org/httpclient-3.x")
libraryLicense(name: "Apache Commons Net", libraryName: "commons-net", version: "2.0", license: "Apache 2.0", url: "http://commons.apache.org/net/")
libraryLicense(name: "Apache Commons Lang", libraryName: "commons-lang", version: "2.4", license: "Apache 2.0", url: "http://commons.apache.org/lang/", licenseUrl: "http://commons.apache.org/lang/license.html")
@@ -1 +1,2 @@
org.jetbrains.jps.incremental.JavaBuilderService
org.jetbrains.jps.incremental.artifacts.ArtifactBuilderService
@@ -0,0 +1,31 @@
package org.jetbrains.jps.incremental;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuilderLogger;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuilderLoggerImpl;
import org.jetbrains.jps.incremental.java.JavaBuilderLogger;
import org.jetbrains.jps.incremental.java.JavaBuilderLoggerImpl;
/**
* @author nik
*/
public class BuildLoggingManager {
public static final BuildLoggingManager DEFAULT = new BuildLoggingManager(new ArtifactBuilderLoggerImpl(), new JavaBuilderLoggerImpl());
private ArtifactBuilderLogger myArtifactBuilderLogger;
private JavaBuilderLogger myJavaBuilderLogger;
public BuildLoggingManager(@NotNull ArtifactBuilderLogger artifactBuilderLogger, @NotNull JavaBuilderLogger logger) {
myArtifactBuilderLogger = artifactBuilderLogger;
myJavaBuilderLogger = logger;
}
@NotNull
public ArtifactBuilderLogger getArtifactBuilderLogger() {
return myArtifactBuilderLogger;
}
@NotNull
public JavaBuilderLogger getJavaBuilderLogger() {
return myJavaBuilderLogger;
}
}
@@ -41,6 +41,7 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
private volatile boolean myErrorsFound = false;
private final long myCompilationStartStamp;
private final TimestampStorage myTsStorage;
private final BuildLoggingManager myLoggingManager;
private final Map<String, String> myBuilderParams;
private final CanceledStatus myCancelStatus;
private float myDone = -1.0f;
@@ -55,9 +56,10 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
TimestampStorage tsStorage,
MessageHandler delegateMessageHandler,
final ModuleRootsIndex rootsIndex,
Map<String, String> builderParams,
BuildLoggingManager loggingManager, Map<String, String> builderParams,
CanceledStatus cancelStatus) throws ProjectBuildException {
myTsStorage = tsStorage;
myLoggingManager = loggingManager;
myBuilderParams = Collections.unmodifiableMap(builderParams);
myCancelStatus = cancelStatus;
myCompilationStartStamp = System.currentTimeMillis();
@@ -90,6 +92,10 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler
return myIsProjectRebuild;
}
public BuildLoggingManager getLoggingManager() {
return myLoggingManager;
}
@Nullable
public String getBuilderParameter(String paramName) {
return myBuilderParams.get(paramName);
@@ -42,6 +42,10 @@ public abstract class CompileScope {
return false;
}
public Set<Artifact> getArtifacts() {
return myArtifacts;
}
@NotNull
public final Project getProject() {
return myProject;
@@ -10,9 +10,9 @@ import com.intellij.util.io.PersistentEnumerator;
import org.jetbrains.jps.*;
import org.jetbrains.jps.api.CanceledStatus;
import org.jetbrains.jps.api.RequestFuture;
import org.jetbrains.jps.artifacts.Artifact;
import org.jetbrains.jps.incremental.java.ExternalJavacDescriptor;
import org.jetbrains.jps.incremental.java.JavaBuilder;
import org.jetbrains.jps.incremental.java.JavaBuilderLogger;
import org.jetbrains.jps.incremental.messages.BuildMessage;
import org.jetbrains.jps.incremental.messages.CompilerMessage;
import org.jetbrains.jps.incremental.messages.ProgressMessage;
@@ -101,7 +101,7 @@ public class IncProjectBuilder {
);
flushContext(context);
if (isMake || isProjectRebuild) {
context = createContext(new AllProjectScope(scope.getProject(), Collections.<Artifact>emptySet(), true), false, true);
context = createContext(new AllProjectScope(scope.getProject(), scope.getArtifacts(), true), false, true);
}
else {
//in case of forced compilation keep the scope, but remove all caches
@@ -208,7 +208,7 @@ public class IncProjectBuilder {
final BuildDataManager dataManager = myProjectDescriptor.dataManager;
return new CompileContext(
scope, isMake, isProjectRebuild, myProductionChunks, myTestChunks, fsState, dataManager, tsStorage, myMessageDispatcher, rootsIndex,
myBuilderParams, myCancelStatus
myProjectDescriptor.getLoggingManager(), myBuilderParams, myCancelStatus
);
}
@@ -322,7 +322,8 @@ public class IncProjectBuilder {
final Collection<String> outputs = sourceToOutputStorage.getState(deletedSource);
if (outputs != null) {
if (LOG.isDebugEnabled()) {
final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger();
if (logger.isEnabled()) {
if (outputs.size() > 0) {
final String[] buffer = new String[outputs.size()];
int i = 0;
@@ -330,11 +331,11 @@ public class IncProjectBuilder {
buffer[i++] = o;
}
Arrays.sort(buffer);
LOG.info("Cleaning output files:");
logger.log("Cleaning output files:");
for(final String o : buffer) {
LOG.info(o);
logger.log(o);
}
LOG.info("End of files");
logger.log("End of files");
}
}
@@ -451,7 +452,8 @@ public class IncProjectBuilder {
}
}
else {
LOG.info("Builder " + builder.getDescription() + " requested second chunk rebuild");
context.getLoggingManager().getJavaBuilderLogger().log(
"Builder " + builder.getDescription() + " requested second chunk rebuild");
}
}
@@ -491,8 +493,9 @@ public class IncProjectBuilder {
final Collection<String> outputs = srcToOut.getState(srcPath);
if (outputs != null) {
final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger();
for (String output : outputs) {
if (LOG.isDebugEnabled()) {
if (logger.isEnabled()) {
allOutputs.add(output);
}
FileUtil.delete(new File(output));
@@ -503,9 +506,10 @@ public class IncProjectBuilder {
}
});
if (LOG.isDebugEnabled()) {
final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger();
if (logger.isEnabled()) {
if (context.isMake() && allOutputs.size() > 0) {
LOG.info("Cleaning output files:");
logger.log("Cleaning output files:");
final String[] buffer = new String[allOutputs.size()];
int i = 0;
for (String output : allOutputs) {
@@ -513,9 +517,9 @@ public class IncProjectBuilder {
}
Arrays.sort(buffer);
for (String output : buffer) {
LOG.info(output);
logger.log(output);
}
LOG.info("End of files");
logger.log("End of files");
}
}
}
@@ -0,0 +1,12 @@
package org.jetbrains.jps.incremental.artifacts;
/**
* @author nik
*/
public interface ArtifactBuilderLogger {
void fileCopied(String sourceFilePath);
void fileDeleted(String targetFilePath);
boolean isEnabled();
}
@@ -0,0 +1,25 @@
package org.jetbrains.jps.incremental.artifacts;
import com.intellij.openapi.diagnostic.Logger;
/**
* @author nik
*/
public class ArtifactBuilderLoggerImpl implements ArtifactBuilderLogger {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.artifacts.ArtifactBuilderLoggerImpl");
@Override
public void fileCopied(String sourceFilePath) {
LOG.debug("Copied:" + sourceFilePath);
}
@Override
public void fileDeleted(String targetFilePath) {
LOG.debug("Deleted:" + targetFilePath);
}
@Override
public boolean isEnabled() {
return LOG.isDebugEnabled();
}
}
@@ -40,7 +40,7 @@ public class ArtifactCompilerPersistentData {
public ArtifactCompilerPersistentData(File cacheStoreDirectory) throws IOException {
myFile = new File(cacheStoreDirectory, "info");
if (!myFile.exists()) {
LOG.info("Artifacts compiler info file doesn't exist: " + myFile.getAbsolutePath());
LOG.debug("Artifacts compiler info file doesn't exist: " + myFile.getAbsolutePath());
myVersionChanged = true;
return;
}
@@ -49,7 +49,7 @@ public class ArtifactCompilerPersistentData {
try {
final int version = input.readInt();
if (version != VERSION) {
LOG.info("Artifacts compiler version changed (" + myFile.getAbsolutePath() + "): " + version + " -> " + VERSION);
LOG.debug("Artifacts compiler version changed (" + myFile.getAbsolutePath() + "): " + version + " -> " + VERSION);
myVersionChanged = true;
return;
}
@@ -44,7 +44,7 @@ public class ArtifactSourceFilesState {
myRootsIndex = rootsIndex;
myTimestampStorage = timestampStorage;
myArtifactId = artifactId;
myMappingsFile = new File(mappingsDir, String.valueOf(artifactId));
myMappingsFile = new File(new File(mappingsDir, String.valueOf(artifactId)), "src-out");
}
public ArtifactSourceToOutputMapping getOrCreateMapping() throws IOException {
@@ -97,10 +97,6 @@ public class ArtifactSourceFilesState {
}
}
public ArtifactSourceTimestampStorage getTimestampStorage() {
return myTimestampStorage;
}
private void processRecursively(File file, SourceFileFilter filter, Set<String> currentPaths) throws IOException {
final String filePath = FileUtil.toSystemIndependentName(FileUtil.toCanonicalPath(file.getPath()));
if (!filter.accept(filePath)) return;
@@ -148,24 +144,27 @@ public class ArtifactSourceFilesState {
return instructionsBuilder;
}
public void updateTimestamps(Set<String> deletedFiles, Set<String> changedFiles) throws IOException {
for (String filePath : deletedFiles) {
public void updateTimestamps() throws IOException {
for (String filePath : myDeletedFiles) {
final ArtifactSourceTimestampStorage.PerArtifactTimestamp[] state = myTimestampStorage.getState(filePath);
if (state == null) continue;
for (int i = 0, length = state.length; i < length; i++) {
if (state[i].myArtifactId == myArtifactId) {
ArrayUtil.remove(state, i);
myTimestampStorage.update(filePath, state);
final ArtifactSourceTimestampStorage.PerArtifactTimestamp[] newState = ArrayUtil.remove(state, i);
myTimestampStorage.update(filePath, newState.length > 0 ? newState : null);
break;
}
}
}
for (String filePath : changedFiles) {
for (String filePath : myChangedFiles) {
final ArtifactSourceTimestampStorage.PerArtifactTimestamp[] state = myTimestampStorage.getState(filePath);
File file = new File(FileUtil.toSystemDependentName(filePath));
final long timestamp = file.lastModified();
myTimestampStorage.update(filePath, updateTimestamp(state, timestamp));
}
}
public void markUpToDate() {
myDeletedFiles.clear();
myChangedFiles.clear();
}
@@ -67,7 +67,7 @@ public class IncArtifactBuilder extends ProjectLevelBuilder {
}
}
private static void buildArtifact(Artifact artifact, CompileContext context) throws ProjectBuildException {
private static void buildArtifact(Artifact artifact, final CompileContext context) throws ProjectBuildException {
final BuildDataManager dataManager = context.getDataManager();
try {
final ArtifactSourceFilesState state = dataManager.getArtifactsBuildData().getOrCreateState(artifact,
@@ -96,10 +96,11 @@ public class IncArtifactBuilder extends ProjectLevelBuilder {
public void process(ArtifactSourceRoot root, Collection<DestinationInfo> destinations) throws IOException {
for (DestinationInfo destination : destinations) {
if (destination instanceof ExplodedDestinationInfo) {
context.getLoggingManager().getArtifactBuilderLogger().fileCopied(filePath);
root.copyFromRoot(filePath, destination.getOutputPath(), outputs);
}
else {
outputs.add(destination.getOutputFilePath());
outputs.add(destination.getOutputFilePath() + JarPathUtil.JAR_SEPARATOR);
changedJars.add(((JarDestinationInfo)destination).getJarInfo());
}
}
@@ -114,10 +115,14 @@ public class IncArtifactBuilder extends ProjectLevelBuilder {
return;
}
state.updateTimestamps(deletedFiles, changedFiles);
for (Map.Entry<String, String[]> entry : updatedMappings.entrySet()) {
mapping.appendData(entry.getKey(), entry.getValue());
state.updateTimestamps();
for (String filePath : deletedFiles) {
mapping.remove(filePath);
}
for (Map.Entry<String, String[]> entry : updatedMappings.entrySet()) {
mapping.update(entry.getKey(), entry.getValue());
}
state.markUpToDate();
context.processMessage(UptoDateFilesSavedEvent.INSTANCE);
}
catch (IOException e) {
@@ -158,6 +163,7 @@ public class IncArtifactBuilder extends ProjectLevelBuilder {
}
if (deleted) {
context.getLoggingManager().getArtifactBuilderLogger().fileDeleted(filePath);
if (isJar) {
deletedJars.add(filePath);
}
@@ -31,6 +31,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.PathUtil;
import org.jetbrains.jps.incremental.CompileContext;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuilderLogger;
import org.jetbrains.jps.incremental.artifacts.IncArtifactBuilder;
import org.jetbrains.jps.incremental.artifacts.instructions.*;
import org.jetbrains.jps.incremental.messages.BuildMessage;
@@ -160,10 +161,12 @@ public class JarsBuilder {
final THashSet<String> writtenPaths = new THashSet<String>();
for (Pair<String, ArtifactSourceRoot> pair : jar.getPackedRoots()) {
final ArtifactSourceRoot root = pair.getSecond();
final ArtifactBuilderLogger logger = myContext.getLoggingManager().getArtifactBuilderLogger();
if (root instanceof FileBasedArtifactSourceRoot) {
addFileToJar(jarOutputStream, jarFile, root.getRootFile(), pair.getFirst(), writtenPaths);
}
else {
logger.fileCopied(FileUtil.toSystemIndependentName(root.getRootFile().getAbsolutePath()));
extractFileAndAddToJar(jarOutputStream, (JarBasedArtifactSourceRoot)root, pair.getFirst(), writtenPaths);
}
}
@@ -184,57 +187,80 @@ public class JarsBuilder {
}
private static void extractFileAndAddToJar(final JarOutputStream jarOutputStream, final JarBasedArtifactSourceRoot root,
final String relativeOutputPath, final THashSet<String> writtenPaths)
final String relativeOutputPath, final Set<String> writtenPaths)
throws IOException {
final long timestamp = root.getRootFile().lastModified();
root.processEntries(new JarBasedArtifactSourceRoot.EntryProcessor() {
@Override
public void process(@Nullable InputStream inputStream, @NotNull String relativePath) throws IOException {
String pathInJar = addParentDirectories(jarOutputStream, writtenPaths, PathUtil.appendToPath(relativeOutputPath, relativePath));
if (!writtenPaths.add(pathInJar)) return;
if (inputStream != null) {
if (inputStream == null) {
addDirectoryEntry(jarOutputStream, pathInJar + "/", writtenPaths);
}
else if (writtenPaths.add(pathInJar)) {
ZipEntry entry = new ZipEntry(pathInJar);
entry.setTime(timestamp);
jarOutputStream.putNextEntry(entry);
FileUtil.copy(inputStream, jarOutputStream);
jarOutputStream.closeEntry();
}
else {
addDirectoryEntry(jarOutputStream, pathInJar + "/");
}
}
});
}
private void addFileToJar(final @NotNull JarOutputStream jarOutputStream, final @NotNull File jarFile, @NotNull File file,
@NotNull String relativePath, final @NotNull THashSet<String> writtenPaths) throws IOException {
if (!file.exists()) {
@NotNull String relativePath, final @NotNull Set<String> writtenPaths) throws IOException {
if (!file.exists() || FileUtil.isAncestor(file, jarFile, false)) {
return;
}
relativePath = addParentDirectories(jarOutputStream, writtenPaths, relativePath);
ZipUtil.addFileOrDirRecursively(jarOutputStream, jarFile, file, relativePath, myFileFilter, writtenPaths);
addFileOrDirRecursively(jarOutputStream, file, relativePath, writtenPaths);
}
private static String addParentDirectories(JarOutputStream jarOutputStream, THashSet<String> writtenPaths, String relativePath) throws IOException {
private void addFileOrDirRecursively(@NotNull ZipOutputStream jarOutputStream, @NotNull File file, @NotNull String relativePath,
@NotNull Set<String> writtenItemRelativePaths) throws IOException {
if (file.isDirectory()) {
final String directoryPath = relativePath.length() == 0 ? "" : relativePath + "/";
if (!directoryPath.isEmpty()) {
addDirectoryEntry(jarOutputStream, directoryPath, writtenItemRelativePaths);
}
final File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
addFileOrDirRecursively(jarOutputStream, child, directoryPath + child.getName(), writtenItemRelativePaths);
}
}
return;
}
final boolean added = ZipUtil.addFileToZip(jarOutputStream, file, relativePath, writtenItemRelativePaths, myFileFilter);
if (added) {
myContext.getLoggingManager().getArtifactBuilderLogger().fileCopied(FileUtil.toSystemIndependentName(file.getAbsolutePath()));
}
}
private static String addParentDirectories(JarOutputStream jarOutputStream, Set<String> writtenPaths, String relativePath) throws IOException {
while (StringUtil.startsWithChar(relativePath, '/')) {
relativePath = relativePath.substring(1);
}
int i = relativePath.indexOf('/');
while (i != -1) {
String prefix = relativePath.substring(0, i+1);
if (!writtenPaths.contains(prefix) && prefix.length() > 1) {
addDirectoryEntry(jarOutputStream, prefix);
writtenPaths.add(prefix);
if (prefix.length() > 1) {
addDirectoryEntry(jarOutputStream, prefix, writtenPaths);
}
i = relativePath.indexOf('/', i + 1);
}
return relativePath;
}
private static void addDirectoryEntry(final ZipOutputStream output, @NonNls final String relativePath) throws IOException {
private static void addDirectoryEntry(final ZipOutputStream output, @NonNls final String relativePath, Set<String> writtenPaths) throws IOException {
if (!writtenPaths.add(relativePath)) return;
ZipEntry e = new ZipEntry(relativePath);
e.setMethod(ZipEntry.STORED);
e.setSize(0);
@@ -61,6 +61,6 @@ public class FileBasedArtifactSourceRoot extends ArtifactSourceRoot {
}
final File targetFile = new File(FileUtil.toSystemDependentName(targetPath));
FileUtil.copyContent(file, targetFile);
outputs.add(outputPath);
outputs.add(targetPath);
}
}
@@ -36,7 +36,6 @@ public class JarDestinationInfo extends DestinationInfo {
private static String appendPathInJar(String outputPath, String pathInJar) {
LOG.assertTrue(outputPath.length() > 0 && outputPath.charAt(outputPath.length() - 1) != '/');
LOG.assertTrue(pathInJar.length() > 0 && pathInJar.charAt(0) != '/');
return outputPath + "!/" + pathInJar;
}
@@ -3,7 +3,6 @@ package org.jetbrains.jps.incremental.java;
import com.intellij.compiler.notNullVerification.NotNullVerifyingInstrumenter;
import com.intellij.execution.process.BaseOSProcessHandler;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
@@ -46,8 +45,6 @@ import java.util.concurrent.TimeUnit;
* Date: 9/21/11
*/
public class JavaBuilder extends ModuleLevelBuilder {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.java.JavaBuilder");
public static final String BUILDER_NAME = "java";
private static final String JAVA_EXTENSION = ".java";
private static final String FORM_EXTENSION = ".form";
@@ -185,9 +182,10 @@ public class JavaBuilder extends ModuleLevelBuilder {
}
}
if (LOG.isDebugEnabled()) {
final JavaBuilderLogger logger = context.getLoggingManager().getJavaBuilderLogger();
if (logger.isEnabled()) {
if (filesToCompile.size() > 0 && context.isMake()) {
LOG.info("Compiling files:");
logger.log("Compiling files:");
final String[] buffer = new String[filesToCompile.size()];
int i = 0;
for (final File f : filesToCompile) {
@@ -195,9 +193,9 @@ public class JavaBuilder extends ModuleLevelBuilder {
}
Arrays.sort(buffer);
for (final String s : buffer) {
LOG.info(s);
logger.log(s);
}
LOG.info("End of files");
logger.log("End of files");
}
}
@@ -0,0 +1,9 @@
package org.jetbrains.jps.incremental.java;
/**
* @author nik
*/
public interface JavaBuilderLogger {
void log(String line);
boolean isEnabled();
}
@@ -0,0 +1,20 @@
package org.jetbrains.jps.incremental.java;
import com.intellij.openapi.diagnostic.Logger;
/**
* @author nik
*/
public class JavaBuilderLoggerImpl implements JavaBuilderLogger {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.java.JavaBuilderLoggerImpl");
@Override
public void log(String line) {
LOG.debug(line);
}
@Override
public boolean isEnabled() {
return LOG.isDebugEnabled();
}
}
@@ -1,6 +1,7 @@
package org.jetbrains.jps.server;
import org.jetbrains.jps.Project;
import org.jetbrains.jps.incremental.BuildLoggingManager;
import org.jetbrains.jps.incremental.FSState;
import org.jetbrains.jps.incremental.ModuleRootsIndex;
import org.jetbrains.jps.incremental.storage.BuildDataManager;
@@ -17,17 +18,27 @@ public final class ProjectDescriptor {
public final FSState fsState;
public final ProjectTimestamps timestamps;
public final BuildDataManager dataManager;
private final BuildLoggingManager myLoggingManager;
public ModuleRootsIndex rootsIndex;
private int myUseCounter = 1;
public ProjectDescriptor(Project project, FSState fsState, ProjectTimestamps timestamps, BuildDataManager dataManager) {
public ProjectDescriptor(Project project,
FSState fsState,
ProjectTimestamps timestamps,
BuildDataManager dataManager,
BuildLoggingManager loggingManager) {
this.project = project;
this.fsState = fsState;
this.timestamps = timestamps;
this.dataManager = dataManager;
myLoggingManager = loggingManager;
this.rootsIndex = new ModuleRootsIndex(project);
}
public BuildLoggingManager getLoggingManager() {
return myLoggingManager;
}
public synchronized void incUsageCounter() {
myUseCounter++;
}
@@ -157,7 +157,7 @@ class ServerState {
msgHandler.processMessage(new CompilerMessage("compile-server", BuildMessage.Kind.INFO, "Project rebuild forced: " + e.getMessage()));
}
pd = new ProjectDescriptor(project, fsState, timestamps, dataManager);
pd = new ProjectDescriptor(project, fsState, timestamps, dataManager, BuildLoggingManager.DEFAULT);
myProjects.put(projectPath, pd);
}
pd.incUsageCounter();
@@ -16,21 +16,18 @@
package org.jetbrains.ether;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import junit.framework.TestCase;
import org.apache.log4j.Level;
import org.apache.log4j.PropertyConfigurator;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.Project;
import org.jetbrains.jps.Sdk;
import org.jetbrains.jps.api.CanceledStatus;
import org.jetbrains.jps.artifacts.Artifact;
import org.jetbrains.jps.idea.IdeaProjectLoader;
import org.jetbrains.jps.incremental.*;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuilderLoggerImpl;
import org.jetbrains.jps.incremental.java.JavaBuilderLogger;
import org.jetbrains.jps.incremental.storage.BuildDataManager;
import org.jetbrains.jps.incremental.storage.ProjectTimestamps;
import org.jetbrains.jps.server.ClasspathBootstrap;
@@ -40,104 +37,15 @@ import java.io.*;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
/**
* @author db
* @since 26.07.11
*/
public abstract class IncrementalTestCase extends TestCase {
private static class RootStripper {
private String root;
void setRoot(final String root) {
this.root = root;
}
String strip(final String s) {
if (s.startsWith(root)) {
return s.substring(root.length());
}
return s;
}
}
static VolatileFileAppender myAppender = null;
static void setAppender (final VolatileFileAppender app) {
myAppender = app;
}
static void closeAppender () {
if (myAppender != null) {
try {
myAppender.closeStream();
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
}
private static class MyFactory implements Logger.Factory {
@Override
public Logger getLoggerInstance(String category) {
final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(category);
final boolean affectedLogger = category.equals("#org.jetbrains.jps.incremental.java.JavaBuilder") ||
category.equals("#org.jetbrains.jps.incremental.IncProjectBuilder");
return new Logger() {
@Override
public boolean isDebugEnabled() {
return affectedLogger;
}
@Override
public void debug(@NonNls String message) {
}
@Override
public void debug(@Nullable Throwable t) {
}
@Override
public void debug(@NonNls String message, @Nullable Throwable t) {
}
@Override
public void error(@NonNls String message, @Nullable Throwable t, @NonNls String... details) {
}
@Override
public void info(@NonNls String message) {
if (affectedLogger) {
logger.info(stripper.strip(message));
}
}
@Override
public void info(@NonNls String message, @Nullable Throwable t) {
}
@Override
public void warn(@NonNls String message, @Nullable Throwable t) {
}
@Override
public void setLevel(Level level) {
}
};
}
}
private static RootStripper stripper = new RootStripper();
private final String groupName;
private final String tempDir = FileUtil.toSystemDependentName(new File(System.getProperty("java.io.tmpdir")).getCanonicalPath());
private Logger.Factory oldFactory;
private String baseDir;
private String workDir;
@@ -149,9 +57,6 @@ public abstract class IncrementalTestCase extends TestCase {
@Override
protected void setUp() throws Exception {
oldFactory = Logger.ourFactory;
Logger.setFactory(new MyFactory());
super.setUp();
baseDir = PathManagerEx.getTestDataPath() + File.separator + "compileServer" + File.separator + "incremental" + File.separator;
@@ -175,13 +80,7 @@ public abstract class IncrementalTestCase extends TestCase {
super.tearDown();
}
finally {
try {
closeAppender();
delete(new File(workDir));
}
finally {
Logger.setFactory(oldFactory);
}
delete(new File(workDir));
}
}
@@ -289,23 +188,7 @@ public abstract class IncrementalTestCase extends TestCase {
}
}
private void initLoggers() {
final Properties properties = new Properties();
properties.setProperty("log4j.rootCategory", "INFO, A1");
properties.setProperty("log4j.appender.A1", "org.jetbrains.ether.VolatileFileAppender");
properties.setProperty("log4j.appender.A1.file", getWorkDir() + ".log");
properties.setProperty("log4j.appender.A1.layout", "org.apache.log4j.PatternLayout");
properties.setProperty("log4j.appender.A1.layout.ConversionPattern", "%m%n");
PropertyConfigurator.configure(properties);
}
public void doTest() throws Exception {
stripper.setRoot(FileUtil.toSystemIndependentName(getWorkDir() + File.separator));
initLoggers();
final String projectPath = getWorkDir() + File.separator + ".idea";
final Project project = new Project();
@@ -319,10 +202,11 @@ public abstract class IncrementalTestCase extends TestCase {
IdeaProjectLoader.loadFromPath(project, projectPath, "");
final File dataStorageRoot = Paths.getDataStorageRoot(project);
final TestJavaBuilderLogger javaBuilderLogger = new TestJavaBuilderLogger(FileUtil.toSystemIndependentName(getWorkDir() + File.separator));
final ProjectDescriptor projectDescriptor =
new ProjectDescriptor(project, new FSState(true), new ProjectTimestamps(dataStorageRoot), new BuildDataManager(dataStorageRoot, true));
new ProjectDescriptor(project, new FSState(true), new ProjectTimestamps(dataStorageRoot),
new BuildDataManager(dataStorageRoot, true), new BuildLoggingManager(new ArtifactBuilderLoggerImpl(), javaBuilderLogger));
try {
new IncProjectBuilder(
projectDescriptor, BuilderRegistry.getInstance(), Collections.<String, String>emptyMap(), CanceledStatus.NULL
).build(
@@ -342,11 +226,31 @@ public abstract class IncrementalTestCase extends TestCase {
);
final String expected = StringUtil.convertLineSeparators(FileUtil.loadFile(new File(getBaseDir() + ".log")));
final String actual = StringUtil.convertLineSeparators(FileUtil.loadFile(new File(getWorkDir() + ".log")));
final String actual = javaBuilderLogger.myLog.toString();
assertEquals(expected, actual);
}
finally {
projectDescriptor.release();
}
}
private static class TestJavaBuilderLogger implements JavaBuilderLogger {
private final String myRoot;
private final StringBuilder myLog;
public TestJavaBuilderLogger(String root) {
myRoot = root;
myLog = new StringBuilder();
}
@Override
public void log(String line) {
myLog.append(StringUtil.trimStart(line, myRoot)).append('\n');
}
@Override
public boolean isEnabled() {
return true;
}
}
}
@@ -1,52 +0,0 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.ether;
import org.apache.log4j.FileAppender;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
/**
* Created with IntelliJ IDEA.
* User: db
* Date: 02.02.12
* Time: 18:27
* To change this template use File | Settings | File Templates.
*/
public class VolatileFileAppender extends FileAppender {
private OutputStream myStream = null;
public VolatileFileAppender() {
super();
IncrementalTestCase.setAppender(this);
}
void closeStream () throws IOException {
if (myStream != null){
myStream.close();
myStream = null;
}
}
@Override
protected OutputStreamWriter createWriter(final OutputStream os) {
myStream = os;
return super.createWriter(os);
}
}
@@ -0,0 +1,321 @@
package org.jetbrains.jps.incremental.artifacts;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.PathUtil;
import org.jetbrains.jps.Library;
import org.jetbrains.jps.Module;
import org.jetbrains.jps.artifacts.Artifact;
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import static com.intellij.util.io.TestFileSystemBuilder.fs;
import static org.jetbrains.jps.incremental.artifacts.LayoutElementTestUtil.archive;
import static org.jetbrains.jps.incremental.artifacts.LayoutElementTestUtil.root;
/**
* @author nik
*/
public class ArtifactBuilderTest extends ArtifactBuilderTestCase {
public void testFileCopy() {
final Artifact a = addArtifact(root().fileCopy(createFile("file.txt", "foo")));
buildAll();
assertOutput(a, fs().file("file.txt", "foo"));
}
public void testDir() {
final Artifact a = addArtifact(
root()
.fileCopy(createFile("abc.txt"))
.dir("dir")
.fileCopy(createFile("xxx.txt", "bar"))
);
buildAll();
assertOutput(a, fs()
.file("abc.txt")
.dir("dir")
.file("xxx.txt", "bar")
);
}
public void testArchive() {
final Artifact a = addArtifact(
root()
.archive("xxx.zip")
.fileCopy(createFile("X.class", "data"))
.dir("dir")
.fileCopy(createFile("Y.class"))
);
buildAll();
assertOutput(a, fs()
.archive("xxx.zip")
.file("X.class", "data")
.dir("dir")
.file("Y.class")
);
}
public void testTwoDirsInArchive() {
final String dir1 = PathUtil.getParentPath(PathUtil.getParentPath(createFile("dir1/a/x.txt")));
final String dir2 = PathUtil.getParentPath(PathUtil.getParentPath(createFile("dir2/a/y.txt")));
final Artifact a = addArtifact(
root()
.archive("a.jar")
.dirCopy(dir1)
.dirCopy(dir2)
.dir("a").fileCopy(createFile("z.txt"))
);
buildAll();
assertOutput(a, fs()
.archive("a.jar")
.dir("a")
.file("x.txt")
.file("y.txt")
.file("z.txt")
);
}
public void testArchiveInArchive() {
final Artifact a = addArtifact(
root()
.archive("a.jar")
.archive("b.jar")
.fileCopy(createFile("xxx.txt", "foo"))
);
buildAll();
assertOutput(a, fs()
.archive("a.jar")
.archive("b.jar")
.file("xxx.txt", "foo")
);
}
public void testIncludedArtifact() {
final Artifact included = addArtifact("included",
root()
.fileCopy(createFile("aaa.txt")));
final Artifact a = addArtifact(
root()
.dir("dir")
.artifact(included)
.end()
.fileCopy(createFile("bbb.txt"))
);
buildAll();
assertOutput(included, fs().file("aaa.txt"));
assertOutput(a, fs()
.dir("dir")
.file("aaa.txt")
.end()
.file("bbb.txt")
);
}
public void testMergeDirectories() {
final Artifact included = addArtifact("included",
root().dir("dir").fileCopy(createFile("aaa.class")));
final Artifact a = addArtifact(
root()
.artifact(included)
.dir("dir")
.fileCopy(createFile("bbb.class")));
buildAll();
assertOutput(a, fs()
.dir("dir")
.file("aaa.class")
.file("bbb.class")
);
}
public void testOverwriteArchives() {
final Artifact included = addArtifact("included",
root().archive("x.jar").fileCopy(createFile("aaa.class")));
final Artifact a = addArtifact(
root()
.artifact(included)
.archive("x.jar")
.fileCopy(createFile("bbb.class")));
buildAll();
assertOutput(a, fs()
.archive("x.jar")
.file("aaa.class")
);
}
public void testOverwriteNestedArchive() {
final Artifact included = addArtifact("included", root().archive("a.jar").archive("b.jar").fileCopy(createFile("c.class")));
final Artifact a = addArtifact(
root()
.artifact(included)
.archive("a.jar").archive("d.jar").fileCopy(createFile("e.class")));
buildAll();
assertOutput(a, fs().archive("a.jar").archive("b.jar").file("c.class"));
}
public void testOverwriteFileByArchive() {
final Library library = addProjectLibrary("lib", getJUnitJarPath());
Artifact included = addArtifact("included", root().archive("junit.jar").fileCopy(createFile("x.class")));
Artifact a = addArtifact(root()
.artifact(included)
.lib(library));
buildAll();
assertOutput(a, fs().archive("junit.jar").file("x.class"));
}
//todo[nik] fix ordering
public void _testOverwriteArchiveByFile() {
Artifact included = addArtifact("included", root().archive("jdom.jar").fileCopy(createFile("x.class")));
Artifact a = addArtifact(root()
.fileCopy(createFile("jdom.jar", "123"))
.artifact(included));
buildAll();
assertOutput(a, fs().file("jdom.jar", "123"));
}
public void testCopyLibrary() {
final Library library = addProjectLibrary("lib", getJUnitJarPath());
final Artifact a = addArtifact(root().lib(library));
buildAll();
assertOutput(a, fs().file("junit.jar"));
}
//todo[nik] fix ordering
public void _testFileOrder() {
final Artifact a1 = addArtifact("included1",
root().dir("ddd").fileCopy(createFile("d1/xxx.txt", "first")));
final Artifact a2 = addArtifact("included2",
root().dir("ddd").fileCopy(createFile("d2/xxx.txt", "second")));
final Artifact a = addArtifact(
root()
.artifact(a1)
.dir("ddd")
.fileCopy(createFile("d3/xxx.txt", "foo"))
.end()
.artifact(a2)
);
buildAll();
assertOutput(a, fs().dir("ddd").file("xxx.txt", "first"));
}
public void testModuleOutput() {
final String file = createFile("src/A.java", "public class A {}");
final Module module = addModule("a", PathUtil.getParentPath(file));
final Artifact artifact = addArtifact(root().module(module));
buildArtifacts(artifact);
assertOutput(artifact, fs().file("A.class"));
}
//todo[nik] support ignored names
public void _testIgnoredFile() {
final String file = createFile("a/.svn/a.txt");
createFile("a/svn/b.txt");
final Artifact a = addArtifact(root().dirCopy(PathUtil.getParentPath(PathUtil.getParentPath(file))));
buildAll();
assertOutput(a, fs().dir("svn").file("b.txt"));
}
//todo[nik] support ignored names
public void _testCopyExcludedFolder() {
//explicitly added excluded files should be copied (e.g. compile output)
final String file = createFile("xxx/excluded/a.txt");
createFile("xxx/excluded/CVS");
final String excluded = PathUtil.getParentPath(file);
final String dir = PathUtil.getParentPath(excluded);
final Module module = addModule("myModule", null);
module.getContentRoots().add(dir);
module.getExcludes().add(excluded);
final Artifact a = addArtifact(root().dirCopy(excluded));
buildAll();
assertOutput(a, fs().file("a.txt"));
}
//todo[nik] support ignored names
public void _testCopyExcludedFile() {
//excluded files under non-excluded directory should not be copied
final String file = createFile("xxx/excluded/a.txt");
createFile("xxx/b.txt");
createFile("xxx/CVS");
final String dir = PathUtil.getParentPath(PathUtil.getParentPath(file));
Module module = addModule("myModule", null);
module.getContentRoots().add(dir);
module.getExcludes().add(PathUtil.getParentPath(file));
final Artifact a = addArtifact(root().dirCopy(dir));
buildAll();
assertOutput(a, fs().file("b.txt"));
}
public void testExtractDirectory() {
final Artifact a = addArtifact("a", root().dir("dir").extractedDir(getJUnitJarPath(), "/junit/textui/"));
buildAll();
assertOutput(a, fs().dir("dir")
.file("ResultPrinter.class")
.file("TestRunner.class"));
}
public void testPackExtractedDirectory() {
final Artifact a = addArtifact("a", root().archive("a.jar").extractedDir(getJUnitJarPath(), "/junit/textui/"));
buildAll();
assertOutput(a, fs().archive("a.jar")
.file("ResultPrinter.class")
.file("TestRunner.class"));
}
public void testSelfIncludingArtifact() {
final Artifact a = addArtifact("a", root());
LayoutElementTestUtil.addArtifactToLayout(a, a);
assertBuildFailed(a);
}
public void testCircularInclusion() {
final Artifact a = addArtifact("a", root());
final Artifact b = addArtifact("b", root());
LayoutElementTestUtil.addArtifactToLayout(a, b);
LayoutElementTestUtil.addArtifactToLayout(b, a);
assertBuildFailed(a);
assertBuildFailed(b);
}
public void testArtifactContainingSelfIncludingArtifact() {
Artifact c = addArtifact("c", root());
final Artifact a = addArtifact("a", root().artifact(c));
LayoutElementTestUtil.addArtifactToLayout(a, a);
final Artifact b = addArtifact("b", root().artifact(a));
buildArtifacts(c);
assertBuildFailed(b);
assertBuildFailed(a);
}
//todo[nik]
//IDEA-73893
public void _testManifestFileIsFirstEntry() throws IOException {
final String firstFile = createFile("src/A.txt");
final String manifestFile = createFile("src/MANIFEST.MF");
final String lastFile = createFile("src/Z.txt");
final Artifact a = addArtifact(archive("a.jar").dir("META-INF")
.fileCopy(firstFile).fileCopy(manifestFile).fileCopy(lastFile));
buildArtifacts(a);
final String jarPath = a.getOutputPath() + "/a.jar";
assertNotNull(jarPath);
JarFile jarFile = new JarFile(new File(FileUtil.toSystemDependentName(jarPath)));
try {
final Enumeration<JarEntry> entries = jarFile.entries();
assertTrue(entries.hasMoreElements());
final JarEntry firstEntry = entries.nextElement();
assertEquals(JarFile.MANIFEST_NAME, firstEntry.getName());
}
finally {
jarFile.close();
}
}
}
@@ -0,0 +1,293 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.artifacts;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.testFramework.UsefulTestCase;
import com.intellij.util.io.TestFileSystemBuilder;
import com.intellij.util.text.UniqueNameGenerator;
import groovy.lang.Closure;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.Library;
import org.jetbrains.jps.Module;
import org.jetbrains.jps.Project;
import org.jetbrains.jps.api.CanceledStatus;
import org.jetbrains.jps.artifacts.Artifact;
import org.jetbrains.jps.incremental.*;
import org.jetbrains.jps.incremental.java.JavaBuilderLoggerImpl;
import org.jetbrains.jps.incremental.messages.BuildMessage;
import org.jetbrains.jps.incremental.storage.BuildDataManager;
import org.jetbrains.jps.incremental.storage.ProjectTimestamps;
import org.jetbrains.jps.server.ProjectDescriptor;
import java.io.File;
import java.io.IOException;
import java.util.*;
import static com.intellij.util.io.TestFileSystemItem.fs;
/**
* @author nik
*/
public abstract class ArtifactBuilderTestCase extends UsefulTestCase {
private ProjectDescriptor myDescriptor;
private Project myProject;
private File myProjectDir;
private TestArtifactBuilderLogger myArtifactBuilderLogger;
protected void setUp() throws Exception {
super.setUp();
myProject = new Project();
myProject.setProjectName(getProjectName());
final File serverRoot = FileUtil.createTempDirectory("compile-server", null);
Paths.getInstance().setSystemRoot(serverRoot);
myArtifactBuilderLogger = new TestArtifactBuilderLogger();
}
@Override
protected void tearDown() throws Exception {
for (Artifact artifact : myProject.getArtifacts().values()) {
FileUtil.delete(new File(FileUtil.toSystemDependentName(artifact.getOutputPath())));
}
myDescriptor.release();
myProjectDir = null;
super.tearDown();
}
protected String createFile(String relativePath) {
return createFile(relativePath, "");
}
protected String createFile(String relativePath, final String text) {
try {
File file = new File(getOrCreateProjectDir(), relativePath);
FileUtil.writeToFile(file, text);
return FileUtil.toSystemIndependentName(file.getAbsolutePath());
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
protected Artifact addArtifact(LayoutElementTestUtil.LayoutElementCreator root) {
final String name = UniqueNameGenerator.generateUniqueName("a", myProject.getArtifacts().keySet());
return addArtifact(name, root);
}
private File getOrCreateProjectDir() {
if (myProjectDir == null) {
try {
myProjectDir = FileUtil.createTempDirectory("prj", null);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
return myProjectDir;
}
protected Artifact addArtifact(String name, LayoutElementTestUtil.LayoutElementCreator root) {
assertFalse("Artifact " + name + " already exists", myProject.getArtifacts().containsKey(name));
Artifact artifact = new Artifact();
artifact.setName(name);
artifact.setRootElement(root.buildElement());
artifact.setOutputPath(FileUtil.toSystemIndependentName(new File(getOrCreateProjectDir(), "out/artifacts/" + name).getAbsolutePath()));
myProject.getArtifacts().put(name, artifact);
return artifact;
}
protected Module addModule(String moduleName, @Nullable String srcPath) {
final Module module = myProject.createModule(moduleName, Closure.IDENTITY);
module.forceInit();
if (srcPath != null) {
module.getContentRoots().add(srcPath);
module.getSourceRoots().add(srcPath);
module.setOutputPath("out/production/" + moduleName);
}
return module;
}
protected Library addProjectLibrary(String name, String jarPath) {
final Library library = myProject.createLibrary(name, Closure.IDENTITY);
library.forceInit();
library.getClasspath().add(jarPath);
return library;
}
protected void buildAll() {
Collection<Artifact> artifacts = myProject.getArtifacts().values();
buildArtifacts(artifacts.toArray(new Artifact[artifacts.size()]));
}
protected void buildArtifacts(Artifact... artifact) {
doBuild(false, false, artifact);
}
private ProjectDescriptor createProjectDescriptor() {
try {
final File dataStorageRoot = Paths.getDataStorageRoot(myProject);
ProjectTimestamps timestamps = new ProjectTimestamps(dataStorageRoot);
BuildDataManager dataManager = new BuildDataManager(dataStorageRoot, true);
return new ProjectDescriptor(myProject, new FSState(true), timestamps, dataManager, new BuildLoggingManager(myArtifactBuilderLogger,
new JavaBuilderLoggerImpl()));
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
private String getProjectName() {
return getTestName(true);
}
private void doBuild(boolean force, final boolean shouldFail, Artifact... artifacts) {
if (myDescriptor == null) {
myDescriptor = createProjectDescriptor();
myDescriptor.incUsageCounter();
}
myArtifactBuilderLogger.clear();
IncProjectBuilder builder = new IncProjectBuilder(myDescriptor, BuilderRegistry.getInstance(), Collections.<String, String>emptyMap(), CanceledStatus.NULL);
final Ref<BuildMessage> errorMessage = Ref.create(null);
builder.addMessageHandler(new MessageHandler() {
@Override
public void processMessage(BuildMessage msg) {
if (msg.getKind() == BuildMessage.Kind.ERROR && errorMessage.isNull()) {
errorMessage.set(msg);
}
}
});
builder.build(new AllProjectScope(myDescriptor.project, new HashSet<Artifact>(Arrays.asList(artifacts)), force), !force, false);
if (shouldFail) {
assertFalse("Build not failed as expected", errorMessage.isNull());
}
else {
assertNull("Build failed: " + errorMessage.get(), errorMessage.get());
}
}
protected static String getJUnitJarPath() {
final File file = PathManager.findFileInLibDirectory("junit.jar");
assertTrue("File " + file.getAbsolutePath() + " doesn't exist", file.exists());
return FileUtil.toSystemIndependentName(file.getAbsolutePath());
}
protected static void assertEmptyOutput(Artifact a1) {
assertOutput(a1, fs());
}
protected void assertBuildFailed(Artifact a) {
doBuild(false, true, a);
}
protected static void change(String filePath) {
change(filePath, null);
}
protected static void change(String filePath, final @Nullable String newContent) {
try {
File file = new File(FileUtil.toSystemDependentName(filePath));
assertTrue("File " + file.getAbsolutePath() + " doesn't exist", file.exists());
if (newContent != null) {
FileUtil.writeToFile(file, newContent);
}
boolean updated = file.setLastModified(file.lastModified() + 1000);
assertTrue("Cannot modify timestamp for " + file.getAbsolutePath(), updated);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
protected static void delete(String filePath) {
File file = new File(FileUtil.toSystemDependentName(filePath));
assertTrue("File " + file.getAbsolutePath() + " doesn't exist", file.exists());
final boolean deleted = FileUtil.delete(file);
assertTrue("Cannot delete file " + file.getAbsolutePath(), deleted);
}
protected void assertCopied(String... filePaths) {
assertSameElements(myArtifactBuilderLogger.myCopiedFilePaths, filePaths);
assertEmpty(myArtifactBuilderLogger.myDeletedFilePaths);
}
protected void assertDeletedAndCopied(String deletedPath, String... copiedPaths) {
assertSameElements(myArtifactBuilderLogger.myDeletedFilePaths, deletedPath);
assertSameElements(myArtifactBuilderLogger.myCopiedFilePaths, copiedPaths);
}
protected static void assertOutput(Artifact a, TestFileSystemBuilder expected) {
expected.build().assertDirectoryEqual(new File(FileUtil.toSystemDependentName(a.getOutputPath())));
}
protected void assertDeleted(String... filePaths) {
assertSameElements(myArtifactBuilderLogger.myDeletedFilePaths, filePaths);
assertEmpty(myArtifactBuilderLogger.myCopiedFilePaths);
}
protected void buildAllAndAssertUpToDate() {
buildAll();
assertUpToDate();
}
protected void assertUpToDate() {
assertCopied();
}
private String getProjectRelativePath(String path) {
assertNotNull(myProjectDir);
final String projectDir = FileUtil.toSystemIndependentName(myProjectDir.getAbsolutePath());
return FileUtil.getRelativePath(projectDir, path, '/');
}
protected static void rename(String path, String newName) {
try {
File file = new File(FileUtil.toSystemDependentName(path));
assertTrue("File " + file.getAbsolutePath() + " doesn't exist", file.exists());
FileUtil.rename(file, new File(file.getParentFile(), newName));
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
private class TestArtifactBuilderLogger implements ArtifactBuilderLogger {
private Set<String> myCopiedFilePaths = new LinkedHashSet<String>();
private Set<String> myDeletedFilePaths = new LinkedHashSet<String>();
@Override
public void fileCopied(String sourceFilePath) {
myCopiedFilePaths.add(getProjectRelativePath(sourceFilePath));
}
@Override
public void fileDeleted(String targetFilePath) {
myDeletedFilePaths.add(getProjectRelativePath(targetFilePath));
}
@Override
public boolean isEnabled() {
return true;
}
public void clear() {
myCopiedFilePaths.clear();
myDeletedFilePaths.clear();
}
}
}
@@ -0,0 +1,182 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.artifacts;
import com.intellij.util.PathUtil;
import org.jetbrains.jps.artifacts.Artifact;
import static com.intellij.util.io.TestFileSystemItem.fs;
import static org.jetbrains.jps.incremental.artifacts.LayoutElementTestUtil.archive;
import static org.jetbrains.jps.incremental.artifacts.LayoutElementTestUtil.root;
/**
* @author nik
*/
public class IncrementalArtifactBuildingTest extends ArtifactBuilderTestCase {
public void testCopyChangedFile() {
String file1 = createFile("a.txt", "aaa");
String file2 = createFile("b.txt", "bbb");
final Artifact a = addArtifact(root().fileCopy(file1).fileCopy(file2));
buildAll();
assertOutput(a, fs().file("a.txt", "aaa").file("b.txt", "bbb"));
buildAllAndAssertUpToDate();
change(file1, "xxx");
buildAll();
assertCopied("a.txt");
assertOutput(a, fs().file("a.txt", "xxx").file("b.txt", "bbb"));
buildAllAndAssertUpToDate();
}
public void testRemoveDeletedFile() {
String file1 = createFile("a.txt");
String file2 = createFile("b.txt");
final Artifact a = addArtifact("a", root().fileCopy(file1).fileCopy(file2));
buildAll();
assertOutput(a, fs().file("a.txt").file("b.txt"));
delete(file1);
buildAll();
assertDeleted("out/artifacts/a/a.txt");
assertOutput(a, fs().file("b.txt"));
buildAllAndAssertUpToDate();
}
public void testPackChangedFile() {
String file1 = createFile("a.txt", "aaa");
String file2 = createFile("b.txt", "bbb");
final Artifact a = addArtifact(archive("a.jar").fileCopy(file1).fileCopy(file2));
buildAll();
assertOutput(a, fs().archive("a.jar").file("a.txt", "aaa").file("b.txt", "bbb"));
buildAllAndAssertUpToDate();
change(file1, "xxx");
buildAll();
assertCopied("a.txt", "b.txt");
assertOutput(a, fs().archive("a.jar").file("a.txt", "xxx").file("b.txt", "bbb"));
buildAllAndAssertUpToDate();
}
public void testRemoveDeletedFileFromArchive() {
String file1 = createFile("a.txt");
String file2 = createFile("b.txt");
final Artifact a = addArtifact("a", archive("a.jar").fileCopy(file1).fileCopy(file2));
buildAll();
assertOutput(a, fs().archive("a.jar").file("a.txt").file("b.txt"));
delete(file1);
buildAll();
assertDeletedAndCopied("out/artifacts/a/a.jar", "b.txt");
assertOutput(a, fs().archive("a.jar").file("b.txt"));
buildAllAndAssertUpToDate();
}
public void testOneFileInTwoArtifacts() {
final String file = createFile("file.txt");
final Artifact a1 = addArtifact("a1", root().dir("dir").fileCopy(file));
final Artifact a2 = addArtifact("a2", root().dir("dir2").fileCopy(file));
buildAll();
buildArtifacts(a1); assertUpToDate();
buildArtifacts(a2); assertUpToDate();
buildAllAndAssertUpToDate();
change(file);
buildArtifacts(a1); assertCopied("file.txt");
buildArtifacts(a1); assertUpToDate();
buildArtifacts(a2); assertCopied("file.txt");
buildArtifacts(a2); assertUpToDate();
buildArtifacts(a1); assertUpToDate();
buildAllAndAssertUpToDate();
}
//IDEADEV-40714
public void testOverwriteFileInArchive() {
final String file1 = createFile("a/a.txt", "a");
final String file2 = createFile("b/a.txt", "b");
addArtifact(root()
.archive("x.jar")
.fileCopy(file1)
.fileCopy(file2));
buildAll();
change(file1);
buildAll();
assertCopied("a/a.txt");
}
public void testRenameFile() throws Exception {
final String file = createFile("a/a.txt");
final Artifact a = addArtifact(root().dirCopy(PathUtil.getParentPath(file)));
buildAll();
assertOutput(a, fs().file("a.txt"));
rename(file, "b.txt");
buildAll();
assertOutput(a, fs().file("b.txt"));
}
//IDEADEV-25840
public void testUpdateFileIfCaseOfLetterInNameChanged() throws Exception {
final String file = createFile("a/a.txt");
final Artifact a = addArtifact("a", root().dirCopy(PathUtil.getParentPath(file)));
buildAll();
assertOutput(a, fs().file("a.txt"));
rename(file, "A.txt");
buildAll();
assertOutput(a, fs().file("A.txt"));
}
//IDEADEV-41556
public void testDeleteFilesFromSelectedArtifactsOnly() throws Exception {
final String file = createFile("a/a.txt");
final Artifact a1 = addArtifact("a1", root().dirCopy(PathUtil.getParentPath(file)));
final Artifact a2 = addArtifact("a2", root().dirCopy(PathUtil.getParentPath(file)));
buildAll();
assertOutput(a1, fs().file("a.txt"));
assertOutput(a2, fs().file("a.txt"));
delete(file);
buildArtifacts(a1); assertDeleted("out/artifacts/a1/a.txt");
assertEmptyOutput(a1);
assertOutput(a2, fs().file("a.txt"));
buildArtifacts(a2); assertDeleted("out/artifacts/a2/a.txt");
assertEmptyOutput(a1);
assertEmptyOutput(a2);
}
//IDEA-51910
public void testTwoArtifactsWithSameOutput() throws Exception {
final String res1 = PathUtil.getParentPath(createFile("res1/a.txt", "1"));
final String res2 = PathUtil.getParentPath(createFile("res2/a.txt", "2"));
final Artifact a1 = addArtifact("a1", root().dirCopy(res1));
final Artifact a2 = addArtifact("a2", root().dirCopy(res2));
a2.setOutputPath(a1.getOutputPath());
assertEquals(a1.getOutputPath(), a2.getOutputPath());
buildArtifacts(a1);
assertOutput(a1, fs().file("a.txt", "1"));
assertOutput(a2, fs().file("a.txt", "1"));
buildArtifacts(a1); assertUpToDate();
buildArtifacts(a2);
assertOutput(a2, fs().file("a.txt", "2"));
}
}
@@ -0,0 +1,119 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jps.incremental.artifacts;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.Library;
import org.jetbrains.jps.Module;
import org.jetbrains.jps.artifacts.*;
import java.util.Collections;
/**
* @author nik
*/
public class LayoutElementTestUtil {
public static LayoutElementCreator root() {
return new LayoutElementCreator(new RootElement(Collections.<LayoutElement>emptyList()), null);
}
public static LayoutElementCreator archive(String name) {
return new LayoutElementCreator(new ArchiveElement(name, Collections.<LayoutElement>emptyList()), null);
}
public static void addArtifactToLayout(Artifact main, Artifact included) {
final ArtifactLayoutElement element = new ArtifactLayoutElement();
element.setArtifactName(included.getName());
((CompositeLayoutElement)main.getRootElement()).getChildren().add(element);
}
public static class LayoutElementCreator {
private CompositeLayoutElement myElement;
private LayoutElementCreator myParent;
public LayoutElementCreator(CompositeLayoutElement element, LayoutElementCreator parent) {
myElement = element;
myParent = parent;
}
public LayoutElementCreator dir(String name) {
DirectoryElement dir = new DirectoryElement(name, Collections.<LayoutElement>emptyList());
myElement.getChildren().add(dir);
return new LayoutElementCreator(dir, this);
}
public LayoutElementCreator archive(String name) {
ArchiveElement archive = new ArchiveElement(name, Collections.<LayoutElement>emptyList());
myElement.getChildren().add(archive);
return new LayoutElementCreator(archive, this);
}
public LayoutElementCreator fileCopy(String filePath) {
return fileCopy(filePath, null);
}
public LayoutElementCreator fileCopy(String filePath, @Nullable String outputFileName) {
myElement.getChildren().add(new FileCopyElement(filePath, outputFileName));
return this;
}
public LayoutElementCreator dirCopy(String dirPath) {
myElement.getChildren().add(new DirectoryCopyElement(dirPath));
return this;
}
public LayoutElementCreator module(Module module) {
final ModuleOutputElement element = new ModuleOutputElement();
element.setModuleName(module.getName());
myElement.getChildren().add(element);
return this;
}
public LayoutElementCreator lib(Library library) {
final LibraryFilesElement element = new LibraryFilesElement();
element.setLibraryName(library.getName());
element.setLibraryLevel(LibraryFilesElement.PROJECT_LEVEL);
myElement.getChildren().add(element);
return this;
}
public LayoutElementCreator extractedDir(String jarPath, String pathInJar) {
ExtractedDirectoryElement dir = new ExtractedDirectoryElement();
dir.setJarPath(jarPath);
dir.setPathInJar(pathInJar);
myElement.getChildren().add(dir);
return this;
}
public LayoutElementCreator artifact(Artifact included) {
final ArtifactLayoutElement element = new ArtifactLayoutElement();
element.setArtifactName(included.getName());
myElement.getChildren().add(element);
return this;
}
public LayoutElementCreator end() {
return myParent;
}
public CompositeLayoutElement buildElement() {
if (myParent != null) {
return myParent.buildElement();
}
return myElement;
}
}
}
@@ -18,6 +18,7 @@ abstract class ComplexLayoutElement extends LayoutElement {
}
class LibraryFilesElement extends ComplexLayoutElement {
public static final String PROJECT_LEVEL = "project"
String moduleName
String libraryName
String libraryLevel
@@ -25,7 +26,7 @@ class LibraryFilesElement extends ComplexLayoutElement {
List<LayoutElement> getSubstitution(Project project) {
Library library
switch (libraryLevel) {
case "project":
case PROJECT_LEVEL:
library = project.libraries[libraryName]
break
case "module":
@@ -14,9 +14,24 @@ abstract class LayoutElement {
class FileCopyElement extends LayoutElement {
String filePath
String outputFileName
FileCopyElement() {
}
FileCopyElement(String filePath, String outputFileName) {
this.filePath = filePath
this.outputFileName = outputFileName
}
}
class DirectoryCopyElement extends LayoutElement {
DirectoryCopyElement() {
}
DirectoryCopyElement(String dirPath) {
this.dirPath = dirPath
}
String dirPath
}
@@ -153,17 +153,4 @@ public final class InjectedLanguageBlockWrapper implements Block {
public boolean isLeaf() {
return myOriginal.isLeaf();
}
}
class A {
private List<Integer> myResult;
{
m(10, myResult);
}
private void m(int i, List<Integer> result) {
if (i > 0) {
m(i - 1, result);
}
result.add(i);
}
}
@@ -20,9 +20,21 @@ import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Field;
/**
* @author max
* @author Konstantin Bulenkov
*/
public abstract class PropertiesComponent {
public abstract void unsetValue(String name);
public abstract boolean isValueSet(String name);
public abstract String getValue(@NonNls String name);
public abstract void setValue(@NonNls String name, String value);
public static PropertiesComponent getInstance(Project project) {
return ServiceManager.getService(project, PropertiesComponent.class);
}
@@ -39,10 +51,6 @@ public abstract class PropertiesComponent {
return isValueSet(name) ? isTrueValue(name) : defaultValue;
}
public abstract boolean isValueSet(String name);
public abstract String getValue(@NonNls String name);
@NotNull
public String getValue(@NonNls String name, @NotNull String defaultValue) {
return isValueSet(name) ? getValue(name) : defaultValue;
@@ -64,6 +72,38 @@ public abstract class PropertiesComponent {
return getValue(name);
}
public abstract void setValue(@NonNls String name, String value);
public final void saveFields(@NotNull Object object) throws IllegalAccessException {
for (Field field : object.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.isAnnotationPresent(PropertyName.class)) {
final String name = field.getAnnotation(PropertyName.class).value();
setValue(name, String.valueOf(field.get(object)));
}
}
}
public final void loadFields(@NotNull Object object) throws IllegalAccessException {
for (Field field : object.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.isAnnotationPresent(PropertyName.class)) {
final PropertyName annotation = field.getAnnotation(PropertyName.class);
final String stringValue = getValue(annotation.value(), annotation.defaultValue());
Object value = null;
final Class<?> type = field.getType();
if (type.equals(boolean.class)) {value = Boolean.valueOf(stringValue);}
else if (type.equals(long.class)) {value = Long.parseLong(stringValue);}
else if (type.equals(int.class)) {value = Integer.parseInt(stringValue);}
else if (type.equals(short.class)) {value = Short.parseShort(stringValue);}
else if (type.equals(byte.class)) {value = Byte.parseByte(stringValue);}
else if (type.equals(double.class)) {value = Double.parseDouble(stringValue);}
else if (type.equals(float.class)) {value = Float.parseFloat(stringValue);}
else if (type.equals(String.class)) {value = stringValue;}
if (value != null) {
field.set(object, value);
}
}
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,20 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.util;
package git4idea.vfs;
import java.util.EventListener;
import java.lang.annotation.*;
/**
* The listener interface that allows tracking actual changes in
* the vcs root configuration.
* Allows to pass property name of field
*
* @author Konstantin Bulenkov
*/
public interface GitRootsListener extends EventListener {
/**
* The method is invoked when set of actual roots changes.
* This could happen when the list of configured roots changes or when
* ".git" directories added/removed for the configured roots.
*/
void gitRootsChanged();
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
public @interface PropertyName {
String value();
String defaultValue() default "";
}
@@ -27,7 +27,7 @@ import java.awt.*;
public class JBLabel extends JLabel implements AnchorableComponent {
private UIUtil.ComponentStyle myComponentStyle = UIUtil.ComponentStyle.REGULAR;
private UIUtil.FontColor myFontColor = UIUtil.FontColor.NORMAL;
private boolean fontColorSetted = false;
private boolean myFontColorSet = false;
private JComponent myAnchor = null;
public JBLabel() {
@@ -86,12 +86,12 @@ public class JBLabel extends JLabel implements AnchorableComponent {
public void setFontColor(@NotNull UIUtil.FontColor fontColor) {
myFontColor = fontColor;
setForeground(UIUtil.getLabelFontColor(myFontColor));
fontColorSetted = true;
myFontColorSet = true;
}
@Override
public void setForeground(Color fg) {
if (!fontColorSetted) super.setForeground(fg);
if (!myFontColorSet) super.setForeground(fg);
}
@Override
@@ -32,6 +32,8 @@ import org.jdom.Element;
import javax.swing.*;
import java.io.IOException;
import java.net.*;
import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
@@ -169,4 +171,17 @@ public class HttpConfigurable implements PersistentStateComponent<HttpConfigurab
Authenticator.setDefault(null);
}
}
public static List<String> getProxyCmdLineProperties() {
List<String> proxy = new ArrayList<String>();
HttpConfigurable httpConfigurable = getInstance();
if (httpConfigurable.USE_HTTP_PROXY) {
proxy.add("-DproxySet=true");
proxy.add("-Dhttp.proxyHost=" + httpConfigurable.PROXY_HOST);
proxy.add("-Dhttp.proxyPort=" + httpConfigurable.PROXY_PORT);
proxy.add("-Dhttps.proxyHost=" + httpConfigurable.PROXY_HOST);
proxy.add("-Dhttps.proxyPort=" + Integer.toString(httpConfigurable.PROXY_PORT));
}
return proxy;
}
}
@@ -43,6 +43,7 @@ import com.intellij.util.Consumer;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import java.awt.*;
@@ -68,7 +69,7 @@ public class ITNReporter extends ErrorReportSubmitter {
String additionalInfo,
Component parentComponent,
Consumer<SubmittedReportInfo> consumer) {
return sendError(events [0], additionalInfo, parentComponent, consumer);
return sendError(events[0], additionalInfo, parentComponent, consumer);
}
/**
@@ -194,11 +195,10 @@ public class ITNReporter extends ErrorReportSubmitter {
ApplicationInfoEx appInfo = (ApplicationInfoEx) ApplicationManager.getApplication().getComponent(ApplicationInfo.class);
String message = DiagnosticBundle.message(
appInfo.isEAP() ? "error.report.new.eap.build.message" : "error.report.new.build.message", e.getMessage());
Messages.showMessageDialog(parentComponent, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon());
showMessageDialog(parentComponent, project, message, CommonBundle.getWarningTitle(), Messages.getWarningIcon());
callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
}
else if (Messages.showYesNoDialog(parentComponent, msg,
ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) {
else if (showYesNoDialog(parentComponent, project, msg, ReportMessages.ERROR_REPORT, Messages.getErrorIcon()) != 0) {
callback.consume(new SubmittedReportInfo(null, "0", SubmittedReportInfo.SubmissionStatus.FAILED));
}
else {
@@ -225,4 +225,20 @@ public class ITNReporter extends ErrorReportSubmitter {
});
return true;
}
private static void showMessageDialog(Component parentComponent, Project project, String message, String title, Icon icon) {
if (parentComponent.isShowing()) {
Messages.showMessageDialog(parentComponent, message, title, icon);
} else {
Messages.showMessageDialog(project, message, title, icon);
}
}
private static int showYesNoDialog(Component parentComponent, Project project, String message, String title, Icon icon) {
if (parentComponent.isShowing()) {
return Messages.showYesNoDialog(parentComponent, message, title, icon);
} else {
return Messages.showYesNoDialog(project, message, title, icon);
}
}
}
@@ -21,10 +21,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.diff.DiffContent;
import com.intellij.openapi.diff.DiffRequest;
import com.intellij.openapi.diff.DiffTool;
import com.intellij.openapi.diff.DiffViewer;
import com.intellij.openapi.diff.*;
import com.intellij.openapi.diff.impl.CompositeDiffPanel;
import com.intellij.openapi.diff.impl.DiffUtil;
import com.intellij.openapi.keymap.KeymapManager;
@@ -161,10 +158,19 @@ public class MultiLevelDiffTool implements DiffTool, DiscloseMultiRequest {
AbstractProperty.AbstractPropertyContainer config = DiffManagerImpl.getInstanceEx().getProperties();
if (isFile && DiffManagerImpl.ENABLE_FILES.value(config)) return false;
if (! isFile && DiffManagerImpl.ENABLE_FOLDERS.value(config)) return false;
return true;
return ! (DiffViewerType.merge.equals(request.getType()) && contentsWriteable(request));
//return request.haveMultipleLayers();
}
private boolean contentsWriteable(DiffRequest request) {
final DiffContent[] contents = request.getContents();
for (DiffContent content : contents) {
if (content != null && content.getDocument().isWritable()) return true;
}
return false;
}
@Override
public DiffViewer createComponent(String title, DiffRequest request, Window window, Disposable parentDisposable) {
// should not be called for it
@@ -110,7 +110,7 @@ message.title.cannot.open.editor=Cannot Open Editor
#configuration
column.info.configure.vcses.directory=Directory
comumn.name.configure.vcses.vcs=VCS
column.name.configure.vcses.vcs=VCS
dialog.title.version.control.configurations=Version Control Configurations
message.text.unable.to.save.settings=Unable to save settings. {0}
message.title.unable.to.save.settings=Unable To Save Settings
@@ -268,7 +268,7 @@ changes.changelist.chooser.title=Choose Changelist
changes.newchangelist.warning.already.exists.text=Changelist ''{0}'' already exists.
changes.newchangelist.warning.already.exists.title=Wrong Changelist Name
commit.dialog.no.changes.detected.text=No changes detected
commit.dialog.no.changes.detected.title=Nothing to commit
commit.dialog.no.changes.detected.title=Nothing to Commit
commit.dialog.title=Commit Changes
commit.dialog.default.commit.operation.name=Comm&it
commit.dialog.include.action.name=Include into commit
@@ -297,7 +297,7 @@ commit.legend.deleted=Deleted:
commit.legend.total=Total:
changes.view.dnd.label={0} file(s)
error.executing.commit=Error executing ''{0}'': {1}
changes.action.rollback.title=Rollback Changes
changes.action.rollback.title={0} Changes
changes.action.rollback.custom.title={0} Changes
changes.dialog.editchangelist.error.already.exists=A changelist named ''{0}'' already exists
error.adding.files.prompt=The following problems have occurred when adding the files:
@@ -361,8 +361,8 @@ patch.apply.error=Failed to apply patch for file {0}: {1}
patch.load.base.revision.error=Failed to load patch base revision for file {0}: {1}
shelve.changes.only.directories=The selected changes affect only directories and no files, so they cannot be shelved
edit.errors=Edit Errors
rollback.modified.without.editing.confirm.single=Would you like to rollback the changes to {0}?
rollback.modified.without.editing.confirm.multiple=Would you like to rollback the changes to {0} selected files?
rollback.modified.without.editing.confirm.single=Would you like to {0} the changes to {1}?
rollback.modified.without.editing.confirm.multiple=Would you like to {0} the changes to {1} selected files?
error.updating.changes=Error updating changes: {0}
ignored.configure.title=Configure Ignored Files
ignored.configure.item.directory=Directory: {0}
@@ -412,7 +412,7 @@ new.changelist.duplicate.name.error=A changelist with that name already exists
perform.edit.in.background=Perform Edit/Checkout in background
browse.changes.action=Browse Changes
browse.changes.scope=Changes affecting {0}
rollback.modified.without.checkout.error.tab=Rollback Modified without Checkout
rollback.modified.without.checkout.error.tab={0} Modified without Checkout
annotate.action.name=Annotate
annotate.action.description=Annotate file
operation.name.annotate=Annotate
@@ -0,0 +1,52 @@
package com.intellij.util.io;
/**
* @author nik
*/
public class TestFileSystemBuilder {
private final TestFileSystemItem myItem;
private final TestFileSystemBuilder myParent;
private TestFileSystemBuilder(TestFileSystemItem item, TestFileSystemBuilder parent) {
myItem = item;
myParent = parent;
}
public TestFileSystemItem build() {
TestFileSystemBuilder builder = this;
while (builder.myParent != null) {
builder = builder.myParent;
}
return builder.myItem;
}
public TestFileSystemBuilder dir(String name) {
final TestFileSystemItem item = new TestFileSystemItem(name, false, true);
myItem.addChild(item);
return new TestFileSystemBuilder(item, this);
}
public TestFileSystemBuilder archive(String name) {
final TestFileSystemItem item = new TestFileSystemItem(name, true, false);
myItem.addChild(item);
return new TestFileSystemBuilder(item, this);
}
public TestFileSystemBuilder file(String name) {
myItem.addChild(new TestFileSystemItem(name, false, false));
return this;
}
public TestFileSystemBuilder file(String name, String content) {
myItem.addChild(new TestFileSystemItem(name, false, false, content));
return this;
}
public TestFileSystemBuilder end() {
return myParent;
}
public static TestFileSystemBuilder fs() {
return new TestFileSystemBuilder(new TestFileSystemItem("root", false, true), null);
}
}
@@ -0,0 +1,85 @@
package com.intellij.util.io;
import com.intellij.openapi.util.io.FileUtil;
import junit.framework.Assert;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
* @author nik
*/
public class TestFileSystemItem {
private final boolean myDirectory;
private final boolean myArchive;
private final String myName;
@Nullable private final String myContent;
private final Map<String, TestFileSystemItem> myChildren = new HashMap<String, TestFileSystemItem>();
TestFileSystemItem(String name, boolean archive, boolean directory, @Nullable String content) {
myDirectory = directory;
myArchive = archive;
myName = name;
myContent = content;
}
TestFileSystemItem(String name, boolean archive, boolean directory) {
this(name, archive, directory, null);
}
void addChild(TestFileSystemItem item) {
Assert.assertFalse(item.myName + " already added", myChildren.containsKey(item.myName));
myChildren.put(item.myName, item);
}
public void assertDirectoryEqual(final File file) {
assertDirectoryEqual(file, "/");
}
private void assertDirectoryEqual(File file, String relativePath) {
final File[] actualChildren = file.listFiles();
Set<String> notFound = new HashSet<String>(myChildren.keySet());
if (actualChildren != null) {
for (File child : actualChildren) {
final String name = child.getName();
final TestFileSystemItem item = myChildren.get(name);
Assert.assertNotNull("unexpected file: " + relativePath + name, item);
item.assertFileEqual(child, relativePath + name + "/");
notFound.remove(name);
}
}
Assert.assertTrue("files " + notFound.toString() + " not found in " + relativePath, notFound.isEmpty());
}
private void assertFileEqual(File file, String relativePath) {
try {
Assert.assertEquals("in " + relativePath, myName, file.getName());
if (myArchive) {
final File dirForExtracted = FileUtil.createTempDirectory("extracted_archive", null);
ZipUtil.extract(file, dirForExtracted, null);
assertDirectoryEqual(dirForExtracted, relativePath);
FileUtil.delete(dirForExtracted);
}
else if (myDirectory) {
Assert.assertTrue(relativePath + file.getName() + " is not a directory", file.isDirectory());
assertDirectoryEqual(file, relativePath);
}
else if (myContent != null) {
final String content = FileUtil.loadFile(file);
Assert.assertEquals("content mismatch for " + relativePath, myContent, content);
}
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
public static TestFileSystemBuilder fs() {
return TestFileSystemBuilder.fs();
}
}
@@ -2164,6 +2164,15 @@ public class StringUtil {
j = startNum2;
while (i < string1Length && isDigit(string1.charAt(i))) i++;
while (j < string2Length && isDigit(string2.charAt(j))) j++;
String digits1 = string1.substring(startNum1, i);
String digits2 = string2.substring(startNum2, j);
if (digits1.length() != digits2.length())
return digits1.length() - digits2.length();
int numberDiff = digits1.compareTo(digits2);
if (numberDiff != 0)
return numberDiff;
i--;
j--;
final int lengthDiff = (i - startNum1) - (j - startNum2);
if (lengthDiff != 0) {
return lengthDiff;
@@ -73,7 +73,7 @@ public class StringUtilTest extends TestCase {
}
public void testNaturalCompare() {
final List<String> strings = new ArrayList(Arrays.asList("Test99", "tes0", "test0", "testing", "test", "test99", "test011", "test1",
final List<String> strings = new ArrayList<String>(Arrays.asList("Test99", "tes0", "test0", "testing", "test", "test99", "test011", "test1",
"test 3", "test2", "test10a", "test10", "1.2.10.5", "1.2.9.1"));
final Comparator<String> c = new Comparator<String>() {
@Override
@@ -84,13 +84,18 @@ public class StringUtilTest extends TestCase {
Collections.sort(strings, c);
assertEquals(Arrays.asList("1.2.9.1", "1.2.10.5", "tes0", "test", "test0", "test1", "test2", "test 3", "test10", "test10a",
"test011", "Test99", "test99", "testing"), strings);
final List<String> strings2 = new ArrayList(Arrays.asList("t1", "t001", "T2", "T002", "T1", "t2"));
final List<String> strings2 = new ArrayList<String>(Arrays.asList("t1", "t001", "T2", "T002", "T1", "t2"));
Collections.sort(strings2, c);
assertEquals(Arrays.asList("T1", "t1", "t001", "T2", "t2", "T002"), strings2);
assertEquals(1 ,StringUtil.naturalCompare("7403515080361171695", "07403515080361171694"));
assertEquals(-14, StringUtil.naturalCompare("_firstField", "myField1"));
//idea-80853
final List<String> strings3 = new ArrayList<String>(
Arrays.asList("C148A_InsomniaCure", "C148B_Escape", "C148C_TersePrincess", "C148D_BagOfMice", "C148E_Porcelain"));
Collections.sort(strings3, c);
assertEquals(Arrays.asList("C148A_InsomniaCure", "C148B_Escape", "C148C_TersePrincess", "C148D_BagOfMice", "C148E_Porcelain"), strings3);
}
public void testFormatLinks() {
assertEquals("<a href=\"http://a-b+c\">http://a-b+c</a>", StringUtil.formatLinks("http://a-b+c"));
}
@@ -426,6 +426,11 @@ public abstract class AbstractVcs<ComList extends CommittedChangeList> extends S
return null;
}
@Nullable
public VcsRootChecker getRootChecker() {
return null;
}
@Nullable
public VcsRootSettings createEmptyVcsRootSettings() {
return null;
@@ -0,0 +1,42 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.vcs;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* Checks VCS roots, revealing invalid roots (registered in the settings, but not related to real VCS roots on disk)
* and unregistered roots (real roots on disk not registered in the settings).
*
* @author Kirill Likhodedov
*/
public interface VcsRootChecker {
/**
* @return VCS roots which are not registered in the Settings | Version Control.
*/
@NotNull
Collection<VirtualFile> getUnregisteredRoots();
/**
* @param directory root to be checked.
* @return true if the given directory is not a VCS root.
*/
boolean isInvalidRoot(@NotNull String directory);
}
@@ -13,35 +13,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.roots;
package com.intellij.openapi.vcs;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
/**
* Incorrect VCS root definition: either an unregistered, or an incorrectly registered VCS root.
*
* @see VcsRootChecker
* @see AbstractVcs#getRootChecker
*
* @author Kirill Likhodedov
*/
class GitRootError {
public class VcsRootError {
private final Type myType;
@NotNull private final VirtualFile myRoot;
private final @NotNull Type myType;
private final @NotNull VirtualFile myRoot;
enum Type {
public enum Type {
EXTRA_ROOT,
UNREGISTERED_ROOT
}
GitRootError(@NotNull Type type, @NotNull VirtualFile root) {
public VcsRootError(@NotNull Type type, @NotNull VirtualFile root) {
myType = type;
myRoot = root;
}
@NotNull
public Type getType() {
return myType;
}
@NotNull
public VirtualFile getRoot() {
return myRoot;
}
@Override
public String toString() {
return "GitRootError{" +
"myType=" + myType +
", myRoot=" + myRoot +
'}';
return String.format("GitRootError{myType=%s, myRoot=%s}", myType, myRoot);
}
@Override
@@ -49,7 +61,7 @@ class GitRootError {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GitRootError error = (GitRootError)o;
VcsRootError error = (VcsRootError)o;
if (!myRoot.equals(error.myRoot)) return false;
if (myType != error.myType) return false;
@@ -57,6 +69,7 @@ class GitRootError {
return true;
}
@SuppressWarnings("ConstantConditions")
@Override
public int hashCode() {
int result = myType != null ? myType.hashCode() : 0;
@@ -26,8 +26,11 @@ import java.util.List;
* @author yole
*/
public abstract class DefaultRollbackEnvironment implements RollbackEnvironment {
public static final String ROLLBACK_OPERATION_NAME = VcsBundle.message("changes.action.rollback.text");
public String getRollbackOperationName() {
return VcsBundle.message("changes.action.rollback.text");
return ROLLBACK_OPERATION_NAME;
}
public void rollbackModifiedWithoutCheckout(final List<VirtualFile> files, final List<VcsException> exceptions,
@@ -32,7 +32,6 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeListManager;
@@ -45,10 +44,15 @@ import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.containers.CollectionFactory;
import com.intellij.vcsUtil.RollbackUtil;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import static com.intellij.openapi.ui.Messages.getQuestionIcon;
import static com.intellij.openapi.ui.Messages.showYesNoDialog;
import static java.util.Arrays.*;
public class RollbackAction extends AnAction implements DumbAware {
public void update(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
@@ -77,14 +81,9 @@ public class RollbackAction extends AnAction implements DumbAware {
}
e.getPresentation().setEnabled(isEnabled);
if (isEnabled) {
final AbstractVcs[] vcss = ProjectLevelVcsManager.getInstance(project).getAllActiveVcss();
for (AbstractVcs vcs : vcss) {
final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
if (rollbackEnvironment != null) {
e.getPresentation().setText(rollbackEnvironment.getRollbackOperationName());
return;
}
}
String operationName = RollbackUtil.getRollbackOperationName(project);
e.getPresentation().setText(operationName);
e.getPresentation().setDescription(operationName + " selected changes");
}
}
@@ -93,7 +92,9 @@ public class RollbackAction extends AnAction implements DumbAware {
if (project == null) {
return;
}
final String title = ActionPlaces.CHANGES_VIEW_TOOLBAR.equals(e.getPlace()) ? null : "Can not rollback now";
final String title = ActionPlaces.CHANGES_VIEW_TOOLBAR.equals(e.getPlace())
? null
: "Can not " + RollbackUtil.getRollbackOperationName(project) + " now";
if (ChangeListManager.getInstance(project).isFreezedWithNotification(title)) return;
FileDocumentManager.getInstance().saveAllDocuments();
@@ -187,7 +188,7 @@ public class RollbackAction extends AnAction implements DumbAware {
final VirtualFile[] virtualFiles = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
if (virtualFiles != null && virtualFiles.length > 0) {
LinkedHashSet<VirtualFile> result = new LinkedHashSet<VirtualFile>(Arrays.asList(virtualFiles));
LinkedHashSet<VirtualFile> result = new LinkedHashSet<VirtualFile>(asList(virtualFiles));
result.retainAll(ChangeListManager.getInstance(project).getModifiedWithoutEditing());
return result;
}
@@ -196,10 +197,13 @@ public class RollbackAction extends AnAction implements DumbAware {
}
private static void rollbackModifiedWithoutEditing(final Project project, final LinkedHashSet<VirtualFile> modifiedWithoutEditing) {
final String operationName = RollbackUtil.getRollbackOperationName(project);
String message = (modifiedWithoutEditing.size() == 1)
? VcsBundle.message("rollback.modified.without.editing.confirm.single", modifiedWithoutEditing.iterator().next().getPresentableUrl())
: VcsBundle.message("rollback.modified.without.editing.confirm.multiple", modifiedWithoutEditing.size());
int rc = Messages.showYesNoDialog(project, message, VcsBundle.message("changes.action.rollback.title"), Messages.getQuestionIcon());
? VcsBundle.message("rollback.modified.without.editing.confirm.single",
modifiedWithoutEditing.iterator().next().getPresentableUrl(), operationName)
: VcsBundle.message("rollback.modified.without.editing.confirm.multiple",
modifiedWithoutEditing.size(), operationName);
int rc = showYesNoDialog(project, message, VcsBundle.message("changes.action.rollback.title", operationName), getQuestionIcon());
if (rc != 0) {
return;
}
@@ -215,10 +219,12 @@ public class RollbackAction extends AnAction implements DumbAware {
final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
if (rollbackEnvironment != null) {
if (indicator != null) {
indicator.setText(vcs.getDisplayName() + ": performing rollback...");
indicator.setText(vcs.getDisplayName() +
": performing " + rollbackEnvironment.getRollbackOperationName().toLowerCase() + "...");
indicator.setIndeterminate(false);
}
rollbackEnvironment.rollbackModifiedWithoutCheckout(items, exceptions, new RollbackProgressModifier(items.size(), indicator));
rollbackEnvironment
.rollbackModifiedWithoutCheckout(items, exceptions, new RollbackProgressModifier(items.size(), indicator));
if (indicator != null) {
indicator.setText2("");
}
@@ -230,17 +236,18 @@ public class RollbackAction extends AnAction implements DumbAware {
// for files refresh
}
if (!exceptions.isEmpty()) {
AbstractVcsHelper.getInstance(project).showErrors(exceptions, VcsBundle.message("rollback.modified.without.checkout.error.tab"));
AbstractVcsHelper.getInstance(project).showErrors(exceptions, VcsBundle.message("rollback.modified.without.checkout.error.tab",
operationName));
}
VirtualFileManager.getInstance().refresh(true, new Runnable() {
public void run() {
for(VirtualFile virtualFile: modifiedWithoutEditing) {
for (VirtualFile virtualFile : modifiedWithoutEditing) {
VcsDirtyScopeManager.getInstance(project).fileDirty(virtualFile);
}
}
});
}
};
progressManager.runProcessWithProgressSynchronously(action, VcsBundle.message("changes.action.rollback.text"), true, project);
progressManager.runProcessWithProgressSynchronously(action, operationName, true, project);
}
}
@@ -21,8 +21,8 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.changes.*;
import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcsUtil.RollbackUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.Nullable;
@@ -98,10 +98,6 @@ public class RollbackChangesDialog extends DialogWrapper {
}
};
myBrowser = new MultipleChangeListBrowser(project, changeLists, changes, null, true, true, myListChangeListener, myListChangeListener);
myBrowser.setToggleActionTitle("Include in rollback");
setOKButtonText(VcsBundle.message("changes.action.rollback.text"));
setTitle(VcsBundle.message("changes.action.rollback.title"));
Set<AbstractVcs> affectedVcs = new HashSet<AbstractVcs>();
for (Change c : changes) {
@@ -111,21 +107,18 @@ public class RollbackChangesDialog extends DialogWrapper {
affectedVcs.add(vcs);
}
}
if (affectedVcs.size() == 1) {
AbstractVcs vcs = (AbstractVcs)affectedVcs.toArray()[0];
final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
if (rollbackEnvironment != null) {
String rollbackOperationName = rollbackEnvironment.getRollbackOperationName();
int pos = rollbackOperationName.indexOf(UIUtil.MNEMONIC);
if (pos >= 0) {
setOKButtonMnemonic(Character.toUpperCase(rollbackOperationName.charAt(pos + 1)));
rollbackOperationName = rollbackOperationName.replace(Character.toString(UIUtil.MNEMONIC), "");
}
setTitle(VcsBundle.message("changes.action.rollback.custom.title", rollbackOperationName).replace("_", ""));
setOKButtonText(rollbackOperationName);
}
String operationName = RollbackUtil.getRollbackOperationName(affectedVcs);
int pos = operationName.indexOf(UIUtil.MNEMONIC);
if (pos >= 0) {
setOKButtonMnemonic(Character.toUpperCase(operationName.charAt(pos + 1)));
operationName = operationName.replace(Character.toString(UIUtil.MNEMONIC), "");
}
setTitle(VcsBundle.message("changes.action.rollback.custom.title", operationName).replace("_", ""));
setOKButtonText(operationName);
myBrowser.setToggleActionTitle("Include in " + operationName.toLowerCase());
for (Change c : changes) {
if (c.getType() == Change.Type.NEW) {
myDeleteLocallyAddedFiles = new JCheckBox(VcsBundle.message("changes.checkbox.delete.locally.added.files"));
@@ -28,14 +28,15 @@ import com.intellij.openapi.vcs.impl.VcsDescriptor;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.*;
import com.intellij.ui.components.JBLabel;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
import com.intellij.ui.table.TableView;
import com.intellij.util.ui.AbstractTableCellEditor;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.border.CompoundBorder;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
@@ -47,6 +48,11 @@ import java.io.File;
import java.util.*;
import java.util.List;
import static com.intellij.openapi.vcs.VcsConfiguration.getInstance;
import static com.intellij.openapi.vcs.VcsConfiguration.ourMaximumFileForBaseRevisionSize;
import static com.intellij.util.ui.UIUtil.DEFAULT_HGAP;
import static com.intellij.util.ui.UIUtil.DEFAULT_VGAP;
/**
* @author yole
*/
@@ -66,8 +72,9 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
private VcsContentAnnotationConfigurable myRecentlyChangedConfigurable;
private final boolean myIsDisabled;
private final VcsConfiguration myVcsConfiguration;
private final @NotNull Map<String, VcsRootChecker> myCheckers;
private static class MyDirectoryRenderer extends ColoredTableCellRenderer {
private class MyDirectoryRenderer extends ColoredTableCellRenderer {
private final Project myProject;
public MyDirectoryRenderer(Project project) {
@@ -77,11 +84,14 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
if (value instanceof VcsDirectoryMapping) {
if (((VcsDirectoryMapping)value).isDefaultMapping()) {
VcsDirectoryMapping mapping = (VcsDirectoryMapping)value;
if (mappingIsError(mapping)) {
setForeground(Color.RED);
}
if (mapping.isDefaultMapping()) {
append(VcsDirectoryMapping.PROJECT_CONSTANT);
return;
}
final VcsDirectoryMapping mapping = (VcsDirectoryMapping)value;
String directory = mapping.getDirectory();
VirtualFile baseDir = myProject.getBaseDir();
if (baseDir != null) {
@@ -92,7 +102,7 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
return;
}
String relativePath = FileUtil.getRelativePath(ioBase, directoryFile);
if (".".equals(relativePath)) {
if (".".equals(relativePath) || relativePath == null) {
append(ioBase.getPath());
}
else {
@@ -102,10 +112,16 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
}
}
}
private boolean mappingIsError(VcsDirectoryMapping mapping) {
String vcs = mapping.getVcs();
VcsRootChecker checker = myCheckers.get(vcs);
return checker != null && checker.isInvalidRoot(mapping.getDirectory());
}
}
private final ColumnInfo<VcsDirectoryMapping, String> VCS_SETTING =
new ColumnInfo<VcsDirectoryMapping, String>(VcsBundle.message("comumn.name.configure.vcses.vcs")) {
new ColumnInfo<VcsDirectoryMapping, String>(VcsBundle.message("column.name.configure.vcses.vcs")) {
public String valueOf(final VcsDirectoryMapping object) {
return object.getVcs();
}
@@ -161,7 +177,7 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
public VcsDirectoryConfigurationPanel(final Project project) {
myProject = project;
myVcsConfiguration = VcsConfiguration.getInstance(myProject);
myVcsConfiguration = getInstance(myProject);
myProjectMessage = "<html>" + StringUtil.escapeXml(VcsDirectoryMapping.PROJECT_CONSTANT) + " - " +
DefaultVcsRootPolicy.getInstance(myProject).getProjectConfigurationMessage(myProject).replace('\n', ' ') + "</html>";
myIsDisabled = myProject.isDefault();
@@ -174,6 +190,10 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
myDirectoryMappingTable = new TableView<VcsDirectoryMapping>();
myBaseRevisionTexts = new JCheckBox("Store on shelf base revision texts for files under DVCS");
myCheckers = new HashMap<String, VcsRootChecker>();
updateRootCheckers();
initPanel();
myDirectoryRenderer = new MyDirectoryRenderer(myProject);
DIRECTORY = new ColumnInfo<VcsDirectoryMapping, VcsDirectoryMapping>(VcsBundle.message("column.info.configure.vcses.directory")) {
@@ -210,6 +230,21 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
}
}
private void updateRootCheckers() {
myCheckers.clear();
for (VcsDescriptor descriptor : myVcsManager.getAllVcss()) {
String name = descriptor.getName();
AbstractVcs vcs = myVcsManager.findVcsByName(name);
if (vcs == null) {
continue;
}
VcsRootChecker checker = vcs.getRootChecker();
if (checker != null) {
myCheckers.put(name, checker);
}
}
}
private void initializeModel() {
List<VcsDirectoryMapping> mappings = new ArrayList<VcsDirectoryMapping>();
for (VcsDirectoryMapping mapping : ProjectLevelVcsManager.getInstance(myProject).getDirectoryMappings()) {
@@ -239,7 +274,6 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
}
private void addMapping() {
Collection<AbstractVcs> activeVcses = getActiveVcses();
VcsMappingConfigurationDialog dlg = new VcsMappingConfigurationDialog(myProject, VcsBundle.message("directory.mapping.add.title"));
// due to wonderful UI designer bug
dlg.initProjectMessage();
@@ -247,13 +281,17 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
if (dlg.isOK()) {
VcsDirectoryMapping mapping = new VcsDirectoryMapping();
dlg.saveToMapping(mapping);
List<VcsDirectoryMapping> items = new ArrayList<VcsDirectoryMapping>(myModel.getItems());
items.add(mapping);
myModel.setItems(items);
checkNotifyListeners(activeVcses);
addMapping(mapping);
}
}
private void addMapping(VcsDirectoryMapping mapping) {
List<VcsDirectoryMapping> items = new ArrayList<VcsDirectoryMapping>(myModel.getItems());
items.add(mapping);
myModel.setItems(items);
checkNotifyListeners(getActiveVcses());
}
private void editMapping() {
Collection<AbstractVcs> activeVcses = getActiveVcses();
VcsMappingConfigurationDialog dlg = new VcsMappingConfigurationDialog(myProject, VcsBundle.message("directory.mapping.remove.title"));
@@ -284,40 +322,56 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
}
protected JComponent createMainComponent() {
JPanel panel = new JPanel(new BorderLayout());
JPanel panel = new JPanel(new GridBagLayout());
GridBag gb = new GridBag()
.setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP))
.setDefaultWeightX(1)
.setDefaultWeightY(0.1)
.setDefaultFill(GridBagConstraints.BOTH);
panel.add(createMappingsTable(), gb.nextLine().next().fillCell().weighty(1));
panel.add(createProjectMappingDescription(), gb.nextLine().next().fillCellHorizontally());
panel.add(createErrorList(), gb.nextLine().next().fillCellHorizontally());
panel.add(createStoreBaseRevisionOption(), gb.nextLine().next().fillCellHorizontally());
panel.add(createShowChangedOption(), gb.nextLine().next().fillCellHorizontally());
return panel;
}
private JComponent createMappingsTable() {
JPanel panelForTable = ToolbarDecorator.createDecorator(myDirectoryMappingTable, null)
.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
addMapping();
updateRootCheckers();
}
}).setEditAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
editMapping();
updateRootCheckers();
}
}).setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
removeMapping();
updateRootCheckers();
}
}).disableUpDownActions().createPanel();
panel.add(panelForTable, BorderLayout.CENTER);
ToolbarDecorator.findAddButton(panelForTable).addCustomUpdater(new AnActionButtonUpdater() {
AnActionButton addButton = ToolbarDecorator.findAddButton(panelForTable);
assert addButton != null;
addButton.addCustomUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
return !myIsDisabled;
}
});
ToolbarDecorator.findEditButton(panelForTable).addCustomUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
final boolean hasSelection = myDirectoryMappingTable.getSelectedObject() != null;
return (!myIsDisabled) && hasSelection;
}
});
ToolbarDecorator.findRemoveButton(panelForTable).addCustomUpdater(new AnActionButtonUpdater() {
AnActionButton editButton = ToolbarDecorator.findEditButton(panelForTable);
assert editButton != null;
editButton.addCustomUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
final boolean hasSelection = myDirectoryMappingTable.getSelectedObject() != null;
@@ -325,37 +379,68 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
}
});
final JPanel wrapper = new JPanel(new BorderLayout());
myRecentlyChangedConfigurable = new VcsContentAnnotationConfigurable(myProject);
AnActionButton removeButton = ToolbarDecorator.findRemoveButton(panelForTable);
assert removeButton != null;
removeButton.addCustomUpdater(new AnActionButtonUpdater() {
@Override
public boolean isEnabled(AnActionEvent e) {
final boolean hasSelection = myDirectoryMappingTable.getSelectedObject() != null;
return (!myIsDisabled) && hasSelection;
}
});
return panelForTable;
}
private JComponent createErrorList() {
Box box = Box.createVerticalBox();
for (Map.Entry<String, VcsRootChecker> entry : myCheckers.entrySet()) {
VcsRootChecker checker = entry.getValue();
for (final VirtualFile root : checker.getUnregisteredRoots()) {
final String vcs = entry.getKey();
String title = "Unregistered " + vcs + " root: " + FileUtil.toSystemDependentName(root.getPresentableUrl());
final VcsRootErrorLabel vcsRootErrorLabel = new VcsRootErrorLabel(title);
vcsRootErrorLabel.setAddRootLinkHandler(new Runnable() {
@Override
public void run() {
addMapping(new VcsDirectoryMapping(root.getPath(), vcs));
vcsRootErrorLabel.setVisible(false);
}
});
box.add(vcsRootErrorLabel);
}
}
return box;
}
private JComponent createProjectMappingDescription() {
final JBLabel label = new JBLabel(myProjectMessage);
label.setComponentStyle(UIUtil.ComponentStyle.SMALL);
label.setFontColor(UIUtil.FontColor.BRIGHTER);
label.setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 0));
wrapper.add(label, BorderLayout.CENTER);
return label;
}
final JBLabel noteLabel =
new JBLabel("File texts bigger than " + VcsConfiguration.ourMaximumFileForBaseRevisionSize / 1000 + "K are not stored");
private JComponent createStoreBaseRevisionOption() {
final JBLabel noteLabel = new JBLabel("File texts bigger than " + ourMaximumFileForBaseRevisionSize / 1000 + "K are not stored");
noteLabel.setComponentStyle(UIUtil.ComponentStyle.SMALL);
noteLabel.setFontColor(UIUtil.FontColor.BRIGHTER);
noteLabel.setBorder(BorderFactory.createEmptyBorder(2, 25, 5, 0));
final JPanel twoPanel = new JPanel(new BorderLayout());
twoPanel.add(myBaseRevisionTexts, BorderLayout.NORTH);
twoPanel.add(noteLabel, BorderLayout.SOUTH);
final JPanel wr2 = new JPanel(new BorderLayout());
wr2.add(twoPanel, BorderLayout.WEST);
myBaseRevisionTexts.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0));
final JPanel wr3 = new JPanel(new BorderLayout());
wr3.add(wr2, BorderLayout.NORTH);
wr3.add(myRecentlyChangedConfigurable.createComponent(), BorderLayout.SOUTH);
wrapper.add(wr3, BorderLayout.SOUTH);
panel.add(wrapper, BorderLayout.SOUTH);
final JPanel panel = new JPanel(new BorderLayout());
panel.add(myBaseRevisionTexts, BorderLayout.NORTH);
panel.add(noteLabel, BorderLayout.SOUTH);
return panel;
}
private JComponent createShowChangedOption() {
myRecentlyChangedConfigurable = new VcsContentAnnotationConfigurable(myProject);
JComponent component = myRecentlyChangedConfigurable.createComponent();
assert component != null;
return component;
}
public void reset() {
initializeModel();
}
@@ -419,4 +504,43 @@ public class VcsDirectoryConfigurationPanel extends PanelWithButtons implements
public void disposeUIResources() {
}
private static class VcsRootErrorLabel extends JPanel {
private final LinkLabel myAddLabel;
VcsRootErrorLabel(String title) {
super(new BorderLayout(DEFAULT_HGAP, DEFAULT_VGAP));
CompoundBorder outsideBorder = BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(5, 0, 5, 0, UIUtil.getPanelBackground()),
BorderFactory.createLineBorder(UIUtil.getPanelBackground().darker()));
setBorder(BorderFactory.createCompoundBorder(outsideBorder, BorderFactory.createEmptyBorder(DEFAULT_VGAP, DEFAULT_HGAP,
DEFAULT_VGAP, DEFAULT_HGAP)));
setOpaque(true);
setBackground(new Color(255, 186, 192));
JBLabel label = new JBLabel(title);
myAddLabel = new LinkLabel("Add root", null);
myAddLabel.setOpaque(false);
JPanel actionsPanel = new JPanel(new BorderLayout(DEFAULT_HGAP, DEFAULT_VGAP));
actionsPanel.setOpaque(false);
actionsPanel.add(myAddLabel, BorderLayout.CENTER);
add(label, BorderLayout.WEST);
add(actionsPanel, BorderLayout.EAST);
}
void setAddRootLinkHandler(final Runnable handler) {
myAddLabel.setListener(new LinkListener() {
@Override
public void linkSelected(LinkLabel aSource, Object aLinkData) {
handler.run();
}
}, null);
}
}
}
@@ -0,0 +1,73 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.vcsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.rollback.DefaultRollbackEnvironment;
import com.intellij.openapi.vcs.rollback.RollbackEnvironment;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import static java.util.Arrays.asList;
/**
* @author Kirill Likhodedov
*/
public class RollbackUtil {
private RollbackUtil() {
}
/**
* Finds the most appropriate name for the "Rollback" operation for the given VCSs.
* That is: iterates through the all {@link RollbackEnvironment#getRollbackOperationName() RollbackEnvironments} and picks
* the operation name if it is equal to all given VCSs.
* Otherwise picks the {@link DefaultRollbackEnvironment#ROLLBACK_OPERATION_NAME default name}.
* @param vcses affected VCSs.
* @return name for the "rollback" operation to be used in the UI.
*/
@NotNull
public static String getRollbackOperationName(@NotNull Collection<AbstractVcs> vcses) {
String operationName = null;
for (AbstractVcs vcs : vcses) {
final RollbackEnvironment rollbackEnvironment = vcs.getRollbackEnvironment();
if (rollbackEnvironment != null) {
if (operationName == null) {
operationName = rollbackEnvironment.getRollbackOperationName();
}
else if (!operationName.equals(rollbackEnvironment.getRollbackOperationName())) {
// if there are different names, use default
return DefaultRollbackEnvironment.ROLLBACK_OPERATION_NAME;
}
}
}
return operationName != null ? operationName : DefaultRollbackEnvironment.ROLLBACK_OPERATION_NAME;
}
/**
* Finds the appropriate name for the "rollback" operation, looking through all VCSs registered in the project.
* @see #getRollbackOperationName(java.util.Collection)
*/
@NotNull
public static String getRollbackOperationName(@NotNull Project project) {
return getRollbackOperationName(asList(ProjectLevelVcsManager.getInstance(project).getAllActiveVcss()));
}
}
@@ -72,6 +72,9 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta
}
};
HttpFileSystem.getInstance().addFileListener(httpVirtualFileListener, project);
for (XBreakpointType<?, ?> type : XBreakpointUtil.getBreakpointTypes()) {
addDefaultBreakpoint(type);
}
}
}
@@ -25,6 +25,7 @@ import org.jetbrains.jps.incremental.messages.CompilerMessage;
import org.jetbrains.jps.incremental.messages.ProgressMessage;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.*;
@@ -464,8 +465,17 @@ public class AndroidPackagingBuilder extends ProjectLevelBuilder {
final String outputPath = releasePackage
? outputFilePath + RELEASE_SUFFIX
: outputFilePath;
// todo: pass assets from apklib, filter ignored files
final Map<AndroidCompilerMessageKind, List<String>> messages = AndroidApt
.packageResources(target, -1, manifestFile.getPath(), resourceDirPaths, assetsDirPath, outputPath, null, !releasePackage, 0);
.packageResources(target, -1, manifestFile.getPath(), resourceDirPaths,
assetsDirPath != null ? new String[]{assetsDirPath} : ArrayUtil.EMPTY_STRING_ARRAY, outputPath, null,
!releasePackage, 0, new FileFilter() {
@Override
public boolean accept(File pathname) {
return true;
}
});
AndroidJpsUtil.addMessages(context, messages, BUILDER_NAME);
return messages.get(AndroidCompilerMessageKind.ERROR).size() == 0;
@@ -234,11 +234,12 @@ public final class AndroidApt {
int platformToolsRevision,
@NotNull String manifestPath,
@NotNull String[] resPaths,
@Nullable String osAssetsPath,
@NotNull String[] osAssetDirPaths,
@NotNull String outputPath,
@Nullable String configFilter,
boolean debugMode,
int versionCode) throws IOException {
int versionCode,
FileFilter assetsFilter) throws IOException {
final ArrayList<String> args = new ArrayList<String>();
//noinspection deprecation
@@ -278,18 +279,57 @@ public final class AndroidApt {
args.add("-M");
args.add(manifestPath);
if (osAssetsPath != null) {
args.add("-A");
args.add(osAssetsPath);
File tempDir = null;
try {
if (osAssetDirPaths.length > 0) {
final String[] nonEmptyAssetDirs = getNonEmptyExistingDirs(osAssetDirPaths);
if (nonEmptyAssetDirs.length > 0) {
if (nonEmptyAssetDirs.length == 1) {
args.add("-A");
args.add(nonEmptyAssetDirs[0]);
}
else {
tempDir = FileUtil.createTempDirectory("android_combined_assets", "tmp");
for (String assetDir : nonEmptyAssetDirs) {
FileUtil.copyDir(new File(assetDir), tempDir, assetsFilter);
}
args.add("-A");
args.add(tempDir.getPath());
}
}
}
args.add("-I");
args.add(target.getPath(IAndroidTarget.ANDROID_JAR));
args.add("-F");
args.add(outputPath);
LOG.info(AndroidCommonUtils.command2string(args));
return AndroidExecutionUtil.doExecute(ArrayUtil.toStringArray(args));
}
finally {
if (tempDir != null) {
FileUtil.delete(tempDir);
}
}
}
args.add("-I");
args.add(target.getPath(IAndroidTarget.ANDROID_JAR));
@NotNull
private static String[] getNonEmptyExistingDirs(@NotNull String[] dirs) {
final List<String> result = new ArrayList<String>();
for (String dirPath : dirs) {
final File dir = new File(dirPath);
args.add("-F");
args.add(outputPath);
if (dir.isDirectory()) {
final File[] children = dir.listFiles();
LOG.info(AndroidCommonUtils.command2string(args));
return AndroidExecutionUtil.doExecute(ArrayUtil.toStringArray(args));
if (children != null && children.length > 0) {
result.add(dirPath);
}
}
}
return ArrayUtil.toStringArray(result);
}
}
@@ -262,6 +262,7 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
}
// todo: support this in android-jps
// see IDEA-79737 for details
private static boolean hasBadCircularDependencies(@NotNull AndroidFacet facet) {
final List<AndroidFacet> dependencies = AndroidSdkUtils.getAllAndroidDependencies(facet.getModule(), true);
@@ -244,13 +244,14 @@ public class AndroidCompileUtil {
return GEN_MODULE_PREFIX + module.getName();
}
public static void createSourceRootIfNotExist(@NotNull final String path, @NotNull final Module module) {
@Nullable
public static VirtualFile createSourceRootIfNotExist(@NotNull final String path, @NotNull final Module module) {
ApplicationManager.getApplication().assertIsDispatchThread();
final File rootFile = new File(path);
final boolean created;
if (!rootFile.exists()) {
if (!rootFile.mkdirs()) return;
if (!rootFile.mkdirs()) return null;
created = true;
}
else {
@@ -266,7 +267,7 @@ public class AndroidCompileUtil {
}
if (project.isDisposed() || module.isDisposed()) {
return;
return null;
}
final VirtualFile root;
@@ -295,9 +296,8 @@ public class AndroidCompileUtil {
}
});
}
excludeFromCompilation(project, root);
}
return root;
}
private static void excludeFromCompilation(@NotNull Project project, @NotNull VirtualFile dir) {
@@ -636,27 +636,37 @@ public class AndroidCompileUtil {
public static void createGenModulesAndSourceRoots(@NotNull final AndroidFacet facet) {
final Module module = facet.getModule();
String sourceRootPath;
final GlobalSearchScope moduleScope = facet.getModule().getModuleScope();
if (FileTypeIndex.getFiles(AndroidRenderscriptFileType.INSTANCE, moduleScope).size() > 0) {
sourceRootPath = AndroidRootUtil.getRenderscriptGenSourceRootPath(facet);
if (sourceRootPath != null) {
createSourceRootIfNotExist(sourceRootPath, module);
initializeGenSourceRoot(module,
AndroidRootUtil.getRenderscriptGenSourceRootPath(facet),
FileTypeIndex.getFiles(AndroidRenderscriptFileType.INSTANCE, moduleScope).size() > 0);
initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true);
initializeGenSourceRoot(module,
AndroidRootUtil.getAidlGenSourceRootPath(facet),
FileTypeIndex.getFiles(AndroidIdlFileType.ourFileType, moduleScope).size() > 0);
}
private static void initializeGenSourceRoot(@NotNull Module module, @Nullable String sourceRootPath, boolean createIfNotExist) {
if (sourceRootPath == null) {
return;
}
VirtualFile sourceRoot = null;
if (createIfNotExist) {
final VirtualFile root = createSourceRootIfNotExist(sourceRootPath, module);
if (root != null) {
sourceRoot = root;
}
}
sourceRootPath = AndroidRootUtil.getAptGenSourceRootPath(facet);
if (sourceRootPath != null) {
createSourceRootIfNotExist(sourceRootPath, module);
if (sourceRoot == null) {
sourceRoot = LocalFileSystem.getInstance().findFileByPath(sourceRootPath);
}
if (FileTypeIndex.getFiles(AndroidIdlFileType.ourFileType, moduleScope).size() > 0) {
sourceRootPath = AndroidRootUtil.getAidlGenSourceRootPath(facet);
if (sourceRootPath != null) {
createSourceRootIfNotExist(sourceRootPath, module);
}
if (sourceRoot != null) {
excludeFromCompilation(module.getProject(), sourceRoot);
}
}
@@ -22,9 +22,11 @@ import com.intellij.openapi.compiler.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import org.jetbrains.android.compiler.tools.AndroidApt;
import org.jetbrains.android.dom.manifest.Application;
import org.jetbrains.android.dom.manifest.Manifest;
@@ -32,14 +34,12 @@ import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.facet.AndroidFacetConfiguration;
import org.jetbrains.android.facet.AndroidRootUtil;
import org.jetbrains.android.sdk.AndroidPlatform;
import org.jetbrains.android.sdk.AndroidSdkUtils;
import org.jetbrains.android.util.AndroidBundle;
import org.jetbrains.android.util.AndroidUtils;
import org.jetbrains.annotations.NotNull;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
import java.io.IOException;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -61,7 +61,11 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null && !facet.getConfiguration().LIBRARY_PROJECT) {
VirtualFile manifestFile = AndroidRootUtil.getManifestFileForCompiler(facet);
VirtualFile assetsDir = AndroidRootUtil.getAssetsDir(facet);
final ArrayList<String> assetDirPathsList = new ArrayList<String>();
collectAssetDirs(facet, assetDirPathsList);
final String[] assetDirPaths = ArrayUtil.toStringArray(assetDirPathsList);
if (manifestFile == null) {
context.addMessage(CompilerMessageCategory.ERROR, AndroidBundle.message("android.compilation.error.manifest.not.found"),
null, -1, -1);
@@ -75,7 +79,6 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
final AndroidPlatform platform = configuration.getAndroidPlatform();
if (platform != null) {
String assetsDirPath = assetsDir != null ? assetsDir.getPath() : null;
String[] resourcesDirPaths = AndroidCompileUtil.collectResourceDirs(facet, true, context);
final IAndroidTarget target = platform.getTarget();
final int platformToolsRevision = platform.getSdkData().getPlatformToolsRevision();
@@ -85,7 +88,7 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
null, -1, -1);
}
items.add(new MyItem(module, target, platformToolsRevision, manifestFile, resourcesDirPaths, assetsDirPath, outputPath,
items.add(new MyItem(module, target, platformToolsRevision, manifestFile, resourcesDirPaths, assetDirPaths, outputPath,
configuration.GENERATE_UNSIGNED_APK, AndroidCompileUtil.isReleaseBuild(context)));
//items.add(new MyItem(module, target, manifestFile, resourcesDirPaths, assetsDirPath, outputPath + RELEASE_SUFFIX, true));
}
@@ -94,6 +97,20 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
}
return items.toArray(new ProcessingItem[items.size()]);
}
private static void collectAssetDirs(@NotNull AndroidFacet facet, @NotNull List<String> result) {
final VirtualFile assetsDir = AndroidRootUtil.getAssetsDir(facet);
if (assetsDir != null) {
result.add(FileUtil.toSystemDependentName(assetsDir.getPath()));
}
for (AndroidFacet depFacet : AndroidSdkUtils.getAllAndroidDependencies(facet.getModule(), true)) {
final VirtualFile depAssetsDir = AndroidRootUtil.getAssetsDir(depFacet);
if (depAssetsDir != null) {
result.add(FileUtil.toSystemDependentName(depAssetsDir.getPath()));
}
}
}
static File getOutputFile(Module module, VirtualFile outputDir) {
return new File(outputDir.getPath(), module.getName() + ".apk.res");
@@ -157,8 +174,14 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
item.myPlatformToolsRevision,
preprocessedManifestFile.getPath(),
item.myResourceDirPaths,
item.myAssetsDirPath,
outputPath, null, !releasePackage, 0));
item.myAssetsDirPaths,
outputPath, null, !releasePackage, 0, new FileFilter() {
@Override
public boolean accept(File file) {
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
return vFile != null && !ProjectRootManager.getInstance(context.getProject()).getFileIndex().isIgnored(vFile);
}
}));
AndroidCompileUtil.addMessages(context, messages, presentableFilesMap);
}
@@ -245,7 +268,7 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
final VirtualFile myManifestFile;
final IAndroidTarget myAndroidTarget;
final String[] myResourceDirPaths;
final String myAssetsDirPath;
final String[] myAssetsDirPaths;
final String myOutputPath;
private final boolean myFileExists;
@@ -258,7 +281,7 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
int platformToolsRevision,
VirtualFile manifestFile,
String[] resourceDirPaths,
String assetsDirPath,
String[] assetsDirPath,
String outputPath,
boolean generateUnsignedApk,
boolean releaseBuild) {
@@ -267,7 +290,7 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
myPlatformToolsRevision = platformToolsRevision;
myManifestFile = manifestFile;
myResourceDirPaths = resourceDirPaths;
myAssetsDirPath = assetsDirPath;
myAssetsDirPaths = assetsDirPath;
myOutputPath = outputPath;
myFileExists = new File(outputPath).exists();
myGenerateUnsignedApk = generateUnsignedApk;
@@ -62,6 +62,10 @@ public class ResourcesValidityState implements ValidityState {
if (resourcesDir != null) {
collectFiles(resourcesDir);
}
VirtualFile assetsDir = AndroidRootUtil.getAssetsDir(facet);
if (assetsDir != null) {
collectFiles(assetsDir);
}
for (AndroidFacet depFacet : AndroidSdkUtils.getAllAndroidDependencies(module, true)) {
VirtualFile depManifest = AndroidRootUtil.getManifestFile(depFacet);
if (depManifest != null) {
@@ -71,10 +75,10 @@ public class ResourcesValidityState implements ValidityState {
if (depResDir != null) {
collectFiles(depResDir);
}
}
VirtualFile assetsDir = AndroidRootUtil.getAssetsDir(facet);
if (assetsDir != null) {
collectFiles(assetsDir);
final VirtualFile depAssetDir = AndroidRootUtil.getAssetsDir(depFacet);
if (depAssetDir != null) {
collectFiles(depAssetDir);
}
}
}
@@ -270,13 +270,29 @@ public abstract class AndroidFacetImporterBase extends FacetImporter<AndroidFace
final MavenId artifactMavenId = artifact.getMavenId();
final String genModuleName = AndroidMavenUtil.getModuleNameForExtApklibArtifact(artifactMavenId);
String genExternalApklibsDirPath = null;
String targetDirPath = null;
final String genExternalApklibsDirPath =
AndroidMavenUtil.computePathForGenExternalApklibsDir(artifactMavenId, mavenProject, mavenTree.getProjects());
final String targetDirPath = genExternalApklibsDirPath != null
? genExternalApklibsDirPath + '/' + AndroidMavenUtil.getMavenIdStringForFileName(artifactMavenId)
: null;
if (apklibModule == null) {
genExternalApklibsDirPath =
AndroidMavenUtil.computePathForGenExternalApklibsDir(artifactMavenId, mavenProject, mavenTree.getProjects());
targetDirPath = genExternalApklibsDirPath != null
? genExternalApklibsDirPath + '/' + AndroidMavenUtil.getMavenIdStringForFileName(artifactMavenId)
: null;
}
else {
final VirtualFile[] contentRoots = ModuleRootManager.getInstance(apklibModule).getContentRoots();
if (contentRoots.length == 1) {
targetDirPath = contentRoots[0].getPath();
}
else {
final String moduleDir = new File(apklibModule.getModuleFilePath()).getParent();
if (moduleDir != null) {
targetDirPath = moduleDir + '/' + AndroidMavenUtil.getMavenIdStringForFileName(artifactMavenId);
}
}
}
if (targetDirPath == null) {
return null;
@@ -1,53 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.HashSet;
import java.util.ArrayList;
import java.util.List;
/**
* The converter for the VCS roots
*/
public class GitRootConverter implements AbstractVcs.RootsConvertor {
/**
* The static instance
*/
public static final GitRootConverter INSTANCE = new GitRootConverter();
/**
* {@inheritDoc}
*/
public List<VirtualFile> convertRoots(List<VirtualFile> result) {
// The method relies on the fact that VFS caches metadata about files,
// so the query should be relatively fast and work mostly with in-memory structures.
// todo useless?
ArrayList<VirtualFile> roots = new ArrayList<VirtualFile>();
HashSet<VirtualFile> listed = new HashSet<VirtualFile>();
for (VirtualFile f : result) {
VirtualFile r = GitUtil.gitRootOrNull(f);
if (r != null && listed.add(r)) {
roots.add(r);
}
}
return roots;
}
}
+7 -19
View File
@@ -50,7 +50,6 @@ import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.util.EventDispatcher;
import com.intellij.util.containers.ComparatorDelegate;
import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.UIUtil;
@@ -72,13 +71,12 @@ import git4idea.i18n.GitBundle;
import git4idea.merge.GitMergeProvider;
import git4idea.rollback.GitRollbackEnvironment;
import git4idea.roots.GitIntegrationEnabler;
import git4idea.roots.GitRootChecker;
import git4idea.roots.GitRootDetectInfo;
import git4idea.roots.GitRootDetector;
import git4idea.status.GitChangeProvider;
import git4idea.ui.branch.GitBranchWidget;
import git4idea.update.GitUpdateEnvironment;
import git4idea.vfs.GitRootTracker;
import git4idea.vfs.GitRootsListener;
import git4idea.vfs.GitVFSListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -129,8 +127,6 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
private GitVFSListener myVFSListener; // a VFS listener that tracks file addition, deletion, and renaming.
private GitRootTracker myRootTracker; // The tracker that checks validity of git roots
private final EventDispatcher<GitRootsListener> myRootListeners = EventDispatcher.create(GitRootsListener.class);
private final BackgroundTaskQueue myTaskQueue; // The queue that is used to schedule background task from actions
private final ReadWriteLock myCommandLock = new ReentrantReadWriteLock(true); // The command read/write lock
private final TreeDiffProvider myTreeDiffProvider;
@@ -309,6 +305,11 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
return dir.isDirectory() && GitUtil.gitRootOrNull(dir) != null;
}
@Override
public VcsRootChecker getRootChecker() {
return new GitRootChecker(myProject, myPlatformFacade);
}
@Override
protected void start() throws VcsException {
}
@@ -325,9 +326,6 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
}
}
if (!myProject.isDefault() && myRootTracker == null) {
myRootTracker = new GitRootTracker(this, myProject, myRootListeners.getMulticaster());
}
if (myVFSListener == null) {
myVFSListener = new GitVFSListener(myProject, this, myGit);
}
@@ -346,10 +344,6 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
@Override
protected void deactivate() {
if (myRootTracker != null) {
myRootTracker.dispose();
myRootTracker = null;
}
if (myVFSListener != null) {
Disposer.dispose(myVFSListener);
myVFSListener = null;
@@ -499,11 +493,6 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
return in;
}
@Override
public RootsConvertor getCustomConvertor() {
return GitRootConverter.INSTANCE;
}
public static VcsKey getKey() {
return ourKey;
}
@@ -550,10 +539,9 @@ public class GitVcs extends AbstractVcs<CommittedChangeList> {
public void enableIntegration() {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
GitRootDetectInfo detectInfo = new GitRootDetector(myProject).detect();
GitRootDetectInfo detectInfo = new GitRootDetector(myProject, myPlatformFacade).detect();
new GitIntegrationEnabler(myProject, myGit, myPlatformFacade).enable(detectInfo);
}
});
}
}
@@ -16,6 +16,7 @@
package git4idea;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
@@ -50,4 +51,7 @@ public interface PlatformFacade {
void showDialog(@NotNull DialogWrapper dialog);
@NotNull
ProjectRootManager getProjectRootManager(@NotNull Project project);
}
@@ -16,6 +16,7 @@
package git4idea;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
@@ -43,6 +44,12 @@ public class PlatformFacadeImpl implements PlatformFacade {
dialog.show();
}
@NotNull
@Override
public ProjectRootManager getProjectRootManager(@NotNull Project project) {
return ProjectRootManager.getInstance(project);
}
@NotNull
@Override
public AbstractVcs getVcs(@NotNull Project project) {
@@ -18,13 +18,18 @@ package git4idea.repo;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsListener;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.util.ArrayUtil;
import git4idea.GitVcs;
import git4idea.PlatformFacade;
import git4idea.roots.GitRootProblemNotifier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -37,31 +42,36 @@ import static git4idea.GitUtil.sortRepositories;
* GitRepositoryManager initializes and stores {@link GitRepository GitRepositories} for Git roots defined in the project.
* @author Kirill Likhodedov
*/
public final class GitRepositoryManager extends AbstractProjectComponent implements Disposable, VcsListener {
public final class GitRepositoryManager extends AbstractProjectComponent implements Disposable {
private final GitVcs myVcs;
private final ProjectLevelVcsManager myVcsManager;
private static final Logger LOG = Logger.getInstance(GitRepositoryManager.class);
private final @NotNull AbstractVcs myVcs;
private final @NotNull ProjectLevelVcsManager myVcsManager;
private final @NotNull PlatformFacade myPlatformFacade;
private final Map<VirtualFile, GitRepository> myRepositories = new HashMap<VirtualFile, GitRepository>();
private final Set<GitRepositoryChangeListener> myListeners = new HashSet<GitRepositoryChangeListener>();
private final ReentrantReadWriteLock REPO_LOCK = new ReentrantReadWriteLock();
@NotNull
public static GitRepositoryManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, GitRepositoryManager.class);
}
public GitRepositoryManager(@NotNull Project project) {
public GitRepositoryManager(@NotNull Project project, @NotNull PlatformFacade platformFacade) {
super(project);
myPlatformFacade = platformFacade;
myVcsManager = ProjectLevelVcsManager.getInstance(myProject);
myVcs = GitVcs.getInstance(myProject);
assert myVcs != null;
myVcs = myPlatformFacade.getVcs(myProject);
}
@Override
public void initComponent() {
myProject.getMessageBus().connect().subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, this);
myProject.getMessageBus().connect().subscribe(VirtualFileManager.VFS_CHANGES, new MyRepositoryCreationDeletionListener());
Disposer.register(myProject, this);
updateRepositoriesCollection();
}
@Override
@@ -152,8 +162,7 @@ public final class GitRepositoryManager extends AbstractProjectComponent impleme
}
// note: we are not calling this method during the project startup - it is called anyway by the GitRootTracker
@Override
public void directoryMappingChanged() {
private void updateRepositoriesCollection() {
try {
REPO_LOCK.writeLock().lock();
final VirtualFile[] roots = myVcsManager.getRootsUnderVcs(myVcs);
@@ -166,16 +175,29 @@ public final class GitRepositoryManager extends AbstractProjectComponent impleme
// add GitRepositories for all roots that don't have correspondent GitRepositories yet.
for (VirtualFile root : roots) {
if (!myRepositories.containsKey(root)) {
GitRepository repository = createGitRepository(root);
myRepositories.put(root, repository);
if (gitRootOK(root)) {
GitRepository repository = createGitRepository(root);
myRepositories.put(root, repository);
}
else {
LOG.info("Invalid Git root: " + root);
}
}
}
GitRootProblemNotifier.getInstance(myProject, myPlatformFacade).rescanAndNotifyIfNeeded();
}
finally {
REPO_LOCK.writeLock().unlock();
}
}
private static boolean gitRootOK(@NotNull VirtualFile root) {
VirtualFile gitDir = root.findChild(".git");
return gitDir != null && gitDir.exists();
}
private GitRepository createGitRepository(VirtualFile root) {
GitRepository repository = GitRepository.getFullInstance(root, myProject, this);
for (GitRepositoryChangeListener listener : myListeners) {
@@ -188,4 +210,20 @@ public final class GitRepositoryManager extends AbstractProjectComponent impleme
public String toString() {
return "GitRepositoryManager{myRepositories: " + myRepositories + '}';
}
private class MyRepositoryCreationDeletionListener implements BulkFileListener {
@Override
public void before(@NotNull List<? extends VFileEvent> events) {
}
@Override
public void after(@NotNull List<? extends VFileEvent> events) {
for (VFileEvent event : events) {
VirtualFile file = event.getFile();
if (file != null && file.getName().equalsIgnoreCase(".git") && file.isDirectory()) {
updateRepositoriesCollection();
}
}
}
}
}
@@ -79,7 +79,6 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
private final Project myProject;
private final VirtualFile myRoot;
private final ChangeListManager myChangeListManager;
private final GitRepositoryManager myRepositoryManager;
private final VcsDirtyScopeManager myDirtyScopeManager;
private final GitRepositoryFiles myRepositoryFiles;
private final Git myGit;
@@ -95,7 +94,6 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
myRoot = root;
myRepositoryFiles = GitRepositoryFiles.getInstance(root);
myChangeListManager = ChangeListManager.getInstance(project);
myRepositoryManager = GitRepositoryManager.getInstance(project);
myDirtyScopeManager = VcsDirtyScopeManager.getInstance(project);
myGit = ServiceManager.getService(Git.class);
}
@@ -297,7 +295,7 @@ public class GitUntrackedFilesHolder implements Disposable, BulkFileListener {
}
private boolean belongsToThisRepository(VirtualFile file) {
final GitRepository repository = myRepositoryManager.getRepositoryForFile(file);
final GitRepository repository = GitRepositoryManager.getInstance(myProject).getRepositoryForFile(file);
return repository != null && repository.getRoot().equals(myRoot);
}
@@ -0,0 +1,61 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.roots;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vcs.VcsRootChecker;
import com.intellij.openapi.vcs.VcsRootError;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.PlatformFacade;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
/**
* @author Kirill Likhodedov
*/
public class GitRootChecker implements VcsRootChecker {
private final Collection<VcsRootError> myErrors;
public GitRootChecker(Project project, PlatformFacade platformFacade) {
myErrors = new GitRootErrorsFinder(project, platformFacade).find();
}
@NotNull
@Override
public Collection<VirtualFile> getUnregisteredRoots() {
Collection<VirtualFile> roots = new ArrayList<VirtualFile>();
for (VcsRootError error : myErrors) {
if (error.getType() == VcsRootError.Type.UNREGISTERED_ROOT) {
roots.add(error.getRoot());
}
}
return roots;
}
@Override
public boolean isInvalidRoot(@NotNull String directory) {
// this information is available in myErrors,
// but the method may be called in VcsDirectoryConfigurationPanel after adding a mapping (to highlight errors right away)
// in which case ProjectLevelVcsManager#getAllVcsRoots() is not aware of new roots yet,
// while GitRootErrorsFinder relies on the set of roots returned from ProjectLevelVcsManager.
return !new File(FileUtil.toSystemDependentName(directory), ".git").exists();
}
}
@@ -19,12 +19,11 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Processor;
import git4idea.PlatformFacade;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.*;
/**
* <p>
@@ -41,9 +40,11 @@ import java.util.Collections;
public class GitRootDetector {
@NotNull private final Project myProject;
@NotNull private final PlatformFacade myPlatformFacade;
public GitRootDetector(@NotNull Project project) {
public GitRootDetector(@NotNull Project project, @NotNull PlatformFacade platformFacade) {
myProject = project;
myPlatformFacade = platformFacade;
}
public GitRootDetectInfo detect() {
@@ -53,13 +54,14 @@ public class GitRootDetector {
return new GitRootDetectInfo(Collections.<VirtualFile>emptyList(), false, false);
}
final Collection<VirtualFile> roots = scanForRootsInsideProject(projectDir);
final Set<VirtualFile> roots = scanForRootsInsideDir(projectDir);
roots.addAll(scanForRootsInContentRoots());
if (roots.contains(projectDir)) {
return new GitRootDetectInfo(roots, true, false);
}
VirtualFile rootAbove = scanForSingleRootAboveProject(projectDir);
VirtualFile rootAbove = scanForSingleRootAboveDir(projectDir);
if (rootAbove != null) {
roots.add(rootAbove);
return new GitRootDetectInfo(roots, true, true);
@@ -67,9 +69,25 @@ public class GitRootDetector {
return new GitRootDetectInfo(roots, false, false);
}
private Set<VirtualFile> scanForRootsInContentRoots() {
Set<VirtualFile> gitRoots = new HashSet<VirtualFile>();
VirtualFile[] roots = myPlatformFacade.getProjectRootManager(myProject).getContentRoots();
for (VirtualFile contentRoot : roots) {
Set<VirtualFile> rootsInsideRoot = scanForRootsInsideDir(contentRoot);
if (!rootsInsideRoot.contains(contentRoot)) {
VirtualFile rootAbove = scanForSingleRootAboveDir(contentRoot);
if (rootAbove != null) {
rootsInsideRoot.add(rootAbove);
}
}
gitRoots.addAll(rootsInsideRoot);
}
return gitRoots;
}
@NotNull
private static Collection<VirtualFile> scanForRootsInsideProject(@NotNull VirtualFile projectDir) {
final Collection<VirtualFile> roots = new ArrayList<VirtualFile>();
private static Set<VirtualFile> scanForRootsInsideDir(@NotNull VirtualFile projectDir) {
final Set<VirtualFile> roots = new HashSet<VirtualFile>();
VfsUtil.processFilesRecursively(projectDir, new Processor<VirtualFile>() {
@Override
public boolean process(VirtualFile virtualFile) {
@@ -83,7 +101,7 @@ public class GitRootDetector {
}
@Nullable
private static VirtualFile scanForSingleRootAboveProject(@NotNull VirtualFile projectDir) {
private static VirtualFile scanForSingleRootAboveDir(@NotNull VirtualFile projectDir) {
VirtualFile parent = projectDir.getParent();
while (parent != null) {
if (hasGitDir(parent)) {
@@ -17,6 +17,7 @@ package git4idea.roots;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsRootError;
import com.intellij.openapi.vfs.VirtualFile;
import git4idea.PlatformFacade;
import org.jetbrains.annotations.NotNull;
@@ -30,30 +31,30 @@ import java.util.Collection;
*
* @author Kirill Likhodedov
*/
class GitRootErrorsFinder {
public class GitRootErrorsFinder {
@NotNull private final Project myProject;
private final PlatformFacade myPlatformFacade;
private final @NotNull Project myProject;
private final @NotNull PlatformFacade myPlatformFacade;
GitRootErrorsFinder(@NotNull Project project, @NotNull PlatformFacade platformFacade) {
public GitRootErrorsFinder(@NotNull Project project, @NotNull PlatformFacade platformFacade) {
myProject = project;
myPlatformFacade = platformFacade;
}
@NotNull
Collection<GitRootError> find() {
public Collection<VcsRootError> find() {
ProjectLevelVcsManager vcsManager = myPlatformFacade.getVcsManager(myProject);
Collection<VirtualFile> vcsRoots = Arrays.asList(vcsManager.getRootsUnderVcs(myPlatformFacade.getVcs(myProject)));
Collection<VirtualFile> gitRoots = new GitRootDetector(myProject).detect().getRoots();
Collection<GitRootError> errors = new ArrayList<GitRootError>();
Collection<VirtualFile> gitRoots = new GitRootDetector(myProject, myPlatformFacade).detect().getRoots();
Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
for (VirtualFile vcsRoot : vcsRoots) {
if (!gitRoots.contains(vcsRoot)) {
errors.add(new GitRootError(GitRootError.Type.EXTRA_ROOT, vcsRoot));
errors.add(new VcsRootError(VcsRootError.Type.EXTRA_ROOT, vcsRoot));
}
}
for (VirtualFile gitRoot : gitRoots) {
if (!vcsRoots.contains(gitRoot)) {
errors.add(new GitRootError(GitRootError.Type.UNREGISTERED_ROOT, gitRoot));
errors.add(new VcsRootError(VcsRootError.Type.UNREGISTERED_ROOT, gitRoot));
}
}
return errors;
@@ -0,0 +1,164 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.roots;
import com.intellij.idea.ActionsBundle;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsRootError;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Function;
import git4idea.GitVcs;
import git4idea.PlatformFacade;
import org.jetbrains.annotations.NotNull;
import javax.swing.event.HyperlinkEvent;
import java.util.ArrayList;
import java.util.Collection;
import static com.intellij.openapi.util.text.StringUtil.pluralize;
/**
* Searches for Git roots problems via {@link GitRootErrorsFinder} and notifies about them.
*
* @author Kirill Likhodedov
*/
public class GitRootProblemNotifier {
private final @NotNull Project myProject;
private final @NotNull PlatformFacade myPlatformFacade;
public static GitRootProblemNotifier getInstance(@NotNull Project project, @NotNull PlatformFacade platformFacade) {
return new GitRootProblemNotifier(project, platformFacade);
}
public GitRootProblemNotifier(@NotNull Project project, @NotNull PlatformFacade platformFacade) {
myProject = project;
myPlatformFacade = platformFacade;
}
public void rescanAndNotifyIfNeeded() {
Collection<VcsRootError> errors = scan();
if (errors.isEmpty()) {
return;
}
Collection<VirtualFile> unregisteredRoots = getUnregisteredRoots(errors);
Collection<VirtualFile> invalidRoots = getInvalidRoots(errors);
String title = makeTitle(unregisteredRoots, invalidRoots);
String description = makeDescription(unregisteredRoots, invalidRoots);
myPlatformFacade.getNotificator(myProject).notify(GitVcs.IMPORTANT_ERROR_NOTIFICATION, title, description,
NotificationType.ERROR, new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && event.getDescription().equals("configure")) {
ShowSettingsUtil.getInstance().showSettingsDialog(myProject, ActionsBundle.message("group.VcsGroup.text"));
Collection<VcsRootError> errorsAfterPossibleFix = scan();
if (errorsAfterPossibleFix.isEmpty() && !notification.isExpired()) {
notification.expire();
}
}
}
});
}
@NotNull
private Collection<VcsRootError> scan() {
return new GitRootErrorsFinder(myProject, myPlatformFacade).find();
}
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
private static String makeDescription(Collection<VirtualFile> unregisteredRoots, Collection<VirtualFile> invalidRoots) {
Function<VirtualFile, String> rootToString = new Function<VirtualFile, String>() {
@Override
public String fun(VirtualFile virtualFile) {
return FileUtil.toSystemDependentName(virtualFile.getPath());
}
};
StringBuilder description = new StringBuilder();
if (!invalidRoots.isEmpty()) {
if (invalidRoots.size() == 1) {
description.append("The directory " + rootToString.fun(invalidRoots.iterator().next()) + " is registered as a Git root, " +
"but it is not.");
}
else {
description.append("The following directories are registered as Git roots, but they are not: <br/>" +
StringUtil.join(invalidRoots, rootToString, ", "));
}
description.append("<br/>");
}
if (!unregisteredRoots.isEmpty()) {
if (unregisteredRoots.size() == 1) {
description.append("The directory " + rootToString.fun(unregisteredRoots.iterator().next()) + " is under Git, " +
"but is not registered in the Settings.");
}
else {
description.append("The following directories are roots of Git repositories, but they are not registered in the Settings: <br/>" +
StringUtil.join(unregisteredRoots, rootToString, ", "));
}
description.append("<br/>");
}
description.append("<a href='configure'>Configure</a>");
return description.toString();
}
private static String makeTitle(Collection<VirtualFile> unregisteredRoots, Collection<VirtualFile> invalidRoots) {
String title;
if (unregisteredRoots.isEmpty()) {
title = "Invalid Git " + pluralize("root", invalidRoots.size());
}
else if (invalidRoots.isEmpty()) {
title = "Unregistered Git " + pluralize("root", unregisteredRoots.size()) + " detected";
}
else {
title = "Git root configuration problems";
}
return title;
}
@NotNull
private static Collection<VirtualFile> getUnregisteredRoots(@NotNull Collection<VcsRootError> errors) {
return filterErrorsByType(errors, VcsRootError.Type.UNREGISTERED_ROOT);
}
@NotNull
private static Collection<VirtualFile> getInvalidRoots(@NotNull Collection<VcsRootError> errors) {
return filterErrorsByType(errors, VcsRootError.Type.EXTRA_ROOT);
}
@NotNull
private static Collection<VirtualFile> filterErrorsByType(@NotNull Collection<VcsRootError> errors, @NotNull VcsRootError.Type type) {
Collection<VirtualFile> roots = new ArrayList<VirtualFile>();
for (VcsRootError error : errors) {
if (error.getType() == type) {
roots.add(error.getRoot());
}
}
return roots;
}
}
@@ -1,40 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.vfs;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.EventListener;
/**
* The listener for configuration change events
*/
public interface GitConfigListener extends EventListener {
/**
* This method is invoked when configuration changes for configured git root.
* If ".git/config" changes, only appropriate root is notified. If "~/.gitconfig" changes,
* all configured roots are notified.
* <p/>
* When root configuration changes, the listeners are called for all new roots.
*
* @param gitRoot the affected git root
* @param configFile the changed configuration file, the parameter might be null if config file is missing
*/
void configChanged(@NotNull VirtualFile gitRoot, @Nullable VirtualFile configFile);
}
@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="git4idea.vfs.GitFixRootsDialog">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="b9e52" 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>
<labelFor value="70a36"/>
<text resource-bundle="git4idea/i18n/GitBundle" key="fix.roots.message"/>
</properties>
</component>
<scrollpane class="com.intellij.ui.components.JBScrollPane" id="70a36">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="704d2" class="com.intellij.ui.components.JBList" binding="myGitRoots">
<constraints/>
<properties>
<toolTipText resource-bundle="git4idea/i18n/GitBundle" key="fix.roots.list.tooltip"/>
</properties>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>
@@ -1,128 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.vfs;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.vcs.FileStatus;
import git4idea.i18n.GitBundle;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.HashSet;
import java.util.TreeSet;
/**
* This dialog shows a new git root set
*/
class GitFixRootsDialog extends DialogWrapper {
/**
* The list of roots
*/
private JList myGitRoots;
/**
* The root panel
*/
private JPanel myPanel;
/**
* The constructor
*
* @param project the context project
*/
protected GitFixRootsDialog(Project project, HashSet<String> current, HashSet<String> added, HashSet<String> removed) {
super(project, true);
setTitle(GitBundle.getString("fix.roots.title"));
setOKButtonText(GitBundle.getString("fix.roots.button"));
TreeSet<Item> items = new TreeSet<Item>();
for (String f : added) {
items.add(new Item(f, FileStatus.ADDED));
}
for (String f : current) {
items.add(new Item(f, removed.contains(f) ? FileStatus.DELETED : FileStatus.NOT_CHANGED));
}
DefaultListModel listModel = new DefaultListModel();
for (Item i : items) {
listModel.addElement(i);
}
myGitRoots.setModel(listModel);
init();
}
/**
* {@inheritDoc}
*/
protected JComponent createCenterPanel() {
return myPanel;
}
/**
* {@inheritDoc}
*/
@Override
protected String getDimensionServiceKey() {
return getClass().getName();
}
/**
* The item in the list
*/
private class Item implements Comparable<Item> {
/**
* The status of the file
*/
@NotNull final FileStatus status;
/**
* The file name
*/
@NotNull final String fileName;
/**
* The constructor
*
* @param fileName the root path
* @param status the root status
*/
public Item(@NotNull String fileName, @NotNull FileStatus status) {
this.fileName = fileName;
this.status = status;
}
/**
* {@inheritDoc}
*/
public int compareTo(Item o) {
return fileName.compareTo(o.fileName);
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
if (status == FileStatus.ADDED) {
return "<html><b>" + fileName + "</b></html>";
}
else if (status == FileStatus.DELETED) {
return "<html><strike>" + fileName + "</strike></html>";
}
else {
return fileName;
}
}
}
}
@@ -1,32 +0,0 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.vfs;
import com.intellij.openapi.vfs.VirtualFile;
import java.util.EventListener;
/**
* The listener for reference changes
*/
public interface GitReferenceListener extends EventListener {
/**
* This method is invoked when some references changed. The events do not describe which ones.
*
* @param root the root for which references might have changed, null if all roots might have been affected
*/
void referencesChanged(VirtualFile root);
}
@@ -1,581 +0,0 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.vfs;
import com.intellij.ProjectTopics;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandAdapter;
import com.intellij.openapi.command.CommandEvent;
import com.intellij.openapi.command.CommandListener;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootEvent;
import com.intellij.openapi.roots.ModuleRootListener;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsDirectoryMapping;
import com.intellij.openapi.vcs.VcsListener;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.ex.VirtualFileManagerAdapter;
import com.intellij.openapi.vfs.ex.VirtualFileManagerEx;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
import git4idea.GitUtil;
import git4idea.GitVcs;
import git4idea.i18n.GitBundle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.event.HyperlinkEvent;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* The component tracks Git roots for the project. If roots are mapped incorrectly it
* shows balloon that notifies user about the problem and offers to correct root mapping.
*/
public class GitRootTracker implements VcsListener {
/**
* The context project
*/
private final Project myProject;
/**
* Tracker of roots for project root manager
*/
private final ProjectRootManager myProjectRoots;
/**
* The vcs manager that tracks content roots
*/
private final ProjectLevelVcsManager myVcsManager;
/**
* The vcs instance
*/
private final GitVcs myVcs;
/**
* If true, the tracking is enabled.
*/
private final AtomicBoolean myIsEnabled = new AtomicBoolean(false);
/**
* If true, the root configuration has been possibly invalidated
*/
private final AtomicBoolean myRootsInvalidated = new AtomicBoolean(true);
/**
* If true, there are some configured git roots, or listener has never been run yet
*/
private final AtomicBoolean myHasGitRoots = new AtomicBoolean(true);
/**
* If true, the notification is currently active and has not been dismissed yet.
*/
private final AtomicBoolean myNotificationPosted = new AtomicBoolean(false);
private final MergingUpdateQueue myQueue;
private Notification myNotification;
/**
* The invalid git roots
*/
private static final String GIT_INVALID_ROOTS_ID = "Git";
/**
* The command listener
*/
private final CommandListener myCommandListener;
/**
* The file listener
*/
private final MyFileListener myFileListener;
/**
* Listener for refresh events
*/
private final VirtualFileManagerAdapter myVirtualFileManagerListener;
/**
* Local file system service
*/
private final LocalFileSystem myLocalFileSystem;
/**
* The multicaster for root events
*/
private final GitRootsListener myMulticaster;
private final MessageBusConnection myMessageBusConnection;
/**
* The constructor
*
* @param project the project instance
* @param multicaster the listeners to notify
*/
public GitRootTracker(GitVcs vcs, @NotNull Project project, @NotNull GitRootsListener multicaster) {
myMulticaster = multicaster;
if (project.isDefault()) {
throw new IllegalArgumentException("The project must not be default");
}
myProject = project;
myProjectRoots = ProjectRootManager.getInstance(myProject);
myQueue = new MergingUpdateQueue("queue", 500, true, null, project, null, false);
myVcs = vcs;
myVcsManager = ProjectLevelVcsManager.getInstance(project);
myVcsManager.addVcsListener(this);
myLocalFileSystem = LocalFileSystem.getInstance();
myMessageBusConnection = myProject.getMessageBus().connect();
myMessageBusConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
public void beforeRootsChange(ModuleRootEvent event) {
// do nothing
}
public void rootsChanged(ModuleRootEvent event) {
invalidate();
}
});
myCommandListener = new CommandAdapter() {
@Override
public void commandFinished(CommandEvent event) {
if (!myRootsInvalidated.compareAndSet(true, false)) {
return;
}
scheduleRootsCheck(false);
}
};
CommandProcessor.getInstance().addCommandListener(myCommandListener);
myFileListener = new MyFileListener();
VirtualFileManagerEx fileManager = (VirtualFileManagerEx)VirtualFileManager.getInstance();
fileManager.addVirtualFileListener(myFileListener);
myVirtualFileManagerListener = new VirtualFileManagerAdapter() {
@Override
public void afterRefreshFinish(boolean asynchronous) {
if (!myRootsInvalidated.compareAndSet(true, false)) {
return;
}
scheduleRootsCheck(false);
}
};
fileManager.addVirtualFileManagerListener(myVirtualFileManagerListener);
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new Runnable() {
public void run() {
myIsEnabled.set(true);
scheduleRootsCheck(true);
}
});
}
/**
* Dispose the component removing all related listeners
*/
public void dispose() {
myVcsManager.removeVcsListener(this);
myMessageBusConnection.disconnect();
CommandProcessor.getInstance().removeCommandListener(myCommandListener);
VirtualFileManagerEx fileManager = (VirtualFileManagerEx)VirtualFileManager.getInstance();
fileManager.removeVirtualFileListener(myFileListener);
fileManager.removeVirtualFileManagerListener(myVirtualFileManagerListener);
}
/**
* {@inheritDoc}
*/
public void directoryMappingChanged() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
scheduleRootsCheck(true);
}
});
}
private void scheduleRootsCheck(final boolean rootsChanged) {
if (ApplicationManager.getApplication().isUnitTestMode() || ApplicationManager.getApplication().isHeadlessEnvironment()) {
doCheckRoots(rootsChanged);
return;
}
myQueue.queue(new Update("root check") {
public void run() {
if (myProject.isDisposed()) return;
doCheckRoots(rootsChanged);
}
});
}
/**
* Check roots for changes.
*
* @param rootsChanged
*/
private void doCheckRoots(boolean rootsChanged) {
if (!myIsEnabled.get() || (!rootsChanged && !myHasGitRoots.get())) {
return;
}
final HashSet<VirtualFile> rootSet = new HashSet<VirtualFile>();
boolean hasInvalidRoots = ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
public Boolean compute() {
for (VcsDirectoryMapping m : myVcsManager.getDirectoryMappings()) {
if (!m.getVcs().equals(myVcs.getName())) {
continue;
}
String path = m.getDirectory();
if (path.length() == 0) {
VirtualFile baseDir = myProject.getBaseDir();
assert baseDir != null;
path = baseDir.getPath();
}
VirtualFile root = lookupFile(path);
VirtualFile actual = GitUtil.gitRootOrNull(root);
if (root == null || rootSet.contains(root) || actual != root) {
return true;
}
rootSet.add(root);
}
return false;
}
});
if (!hasInvalidRoots && rootSet.isEmpty()) {
myHasGitRoots.set(false);
return;
}
else {
myHasGitRoots.set(true);
}
if (!hasInvalidRoots) {
// check if roots have a problem
for (final VirtualFile root : rootSet) {
hasInvalidRoots = hasUnmappedSubroots(root, rootSet, 0);
if (hasInvalidRoots) {
break;
}
}
}
if (!hasInvalidRoots) {
// all roots are correct
if (myNotificationPosted.compareAndSet(true, false)) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
public void run() {
if (myNotification != null) {
if (!myNotification.isExpired()) {
myNotification.expire();
}
myNotification = null;
}
}
});
}
}
else if (myNotificationPosted.compareAndSet(false, true)) {
UIUtil.invokeLaterIfNeeded(new Runnable() {
public void run() {
myNotification = new Notification(GIT_INVALID_ROOTS_ID, GitBundle.getString("root.tracker.message.title"),
GitBundle.getString("root.tracker.message"), NotificationType.ERROR,
new NotificationListener() {
public void hyperlinkUpdate(@NotNull final Notification notification,
@NotNull HyperlinkEvent event) {
fixRoots(notification);
}
});
Notifications.Bus.notify(myNotification, myProject);
}
});
}
UIUtil.invokeLaterIfNeeded(new Runnable() {
public void run() {
myMulticaster.gitRootsChanged();
}
});
}
/**
* Check if there are some unmapped subdirectories under git
*
* @param directory the content root to check
* @param rootSet the mapped root set
* @param depth
*/
private static boolean hasUnmappedSubroots(final VirtualFile directory, final @NotNull HashSet<VirtualFile> rootSet, int depth) {
if (depth > 3) { // three is quite enough
return false;
}
VirtualFile[] children = ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile[]>() {
public VirtualFile[] compute() {
return directory.isValid() ? directory.getChildren() : VirtualFile.EMPTY_ARRAY;
}
});
for (final VirtualFile child : children) {
if (!child.isDirectory()) {
continue;
}
if (child.getName().equals(".git")) {
return !rootSet.contains(child.getParent());
}
if (hasUnmappedSubroots(child, rootSet, depth + 1)) {
return true;
}
}
return false;
}
/**
* Fix mapped roots
* @param notification Expires the notification if roots are in the correct state after fix.
*/
private void fixRoots(final Notification notification) {
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override public void run() {
final List<VcsDirectoryMapping> vcsDirectoryMappings = new ArrayList<VcsDirectoryMapping>(myVcsManager.getDirectoryMappings());
final HashSet<String> mapped = new HashSet<String>();
final HashSet<String> removed = new HashSet<String>();
final HashSet<String> added = new HashSet<String>();
collectRoots(vcsDirectoryMappings, mapped, removed, added);
final VirtualFile baseDir = myProject.getBaseDir();
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override public void run() {
if (added.isEmpty() && removed.isEmpty()) {
Messages.showInfoMessage(myProject, GitBundle.message("fix.roots.valid.message"), GitBundle.message("fix.roots.valid.title"));
notification.expire();
return;
}
GitFixRootsDialog d = new GitFixRootsDialog(myProject, mapped, added, removed);
d.show();
if (!d.isOK()) {
return;
}
for (Iterator<VcsDirectoryMapping> i = vcsDirectoryMappings.iterator(); i.hasNext(); ) {
VcsDirectoryMapping m = i.next();
String path = m.getDirectory();
if (removed.contains(path) || (path.length() == 0 && baseDir != null && removed.contains(baseDir.getPath()))) {
i.remove();
}
}
for (String a : added) {
vcsDirectoryMappings.add(new VcsDirectoryMapping(a, myVcs.getName()));
}
myVcsManager.setDirectoryMappings(vcsDirectoryMappings);
myVcsManager.updateActiveVcss();
notification.expire();
}
});
}
});
}
private void collectRoots(List<VcsDirectoryMapping> vcsDirectoryMappings,
HashSet<String> mapped,
HashSet<String> removed,
HashSet<String> added) {
final VirtualFile baseDir = myProject.getBaseDir();
for (Iterator<VcsDirectoryMapping> i = vcsDirectoryMappings.iterator(); i.hasNext();) {
VcsDirectoryMapping m = i.next();
String vcsName = myVcs.getName();
if (!vcsName.equals(m.getVcs())) {
continue;
}
String path = m.getDirectory();
if (path.length() == 0 && baseDir != null) {
path = baseDir.getPath();
}
VirtualFile file = lookupFile(path);
if (file != null && !mapped.add(file.getPath())) {
// eliminate duplicates
i.remove();
continue;
}
final VirtualFile actual = GitUtil.gitRootOrNull(file);
if (file == null || actual == null) {
removed.add(path);
}
else if (actual != file) {
removed.add(path);
added.add(actual.getPath());
}
}
for (String m : mapped) {
VirtualFile file = lookupFile(m);
if (file == null) {
continue;
}
addSubroots(file, added, mapped);
if (removed.contains(m)) {
continue;
}
VirtualFile root = GitUtil.gitRootOrNull(file);
assert root != null;
for (String o : mapped) {
// the mapped collection is not modified here, so order is being kept
if (o.equals(m) || removed.contains(o)) {
continue;
}
if (o.startsWith(m)) {
VirtualFile otherFile = lookupFile(m);
assert otherFile != null;
VirtualFile otherRoot = GitUtil.gitRootOrNull(otherFile);
assert otherRoot != null;
if (otherRoot == root) {
removed.add(o);
}
else if (otherFile != otherRoot) {
added.add(otherRoot.getPath());
removed.add(o);
}
}
}
}
}
/**
* Look up file in the file system
*
* @param path the path to lookup
* @return the file or null if the file not found
*/
@Nullable
private VirtualFile lookupFile(String path) {
return myLocalFileSystem.findFileByPath(path);
}
/**
* Add subroots for the content root
*
* @param directory the content root to check
* @param toAdd collection of roots to be added
* @param mapped all mapped git roots
*/
private static void addSubroots(VirtualFile directory, HashSet<String> toAdd, HashSet<String> mapped) {
for (VirtualFile child : directory.getChildren()) {
if (!child.isDirectory()) {
continue;
}
if (child.getName().equals(".git") && !mapped.contains(directory.getPath())) {
toAdd.add(directory.getPath());
}
else {
addSubroots(child, toAdd, mapped);
}
}
}
/**
* Invalidate git root
*/
private void invalidate() {
myRootsInvalidated.set(true);
}
/**
* The listener for git roots
*/
private class MyFileListener extends VirtualFileAdapter {
/**
* Return true if file has git repositories
*
* @param file the file to check
* @return true if file has git repositories
*/
private boolean hasGitRepositories(VirtualFile file) {
if (!file.isDirectory() || !file.getName().equals(".git")) {
return false;
}
VirtualFile baseDir = myProject.getBaseDir();
if (baseDir == null) {
return false;
}
if (!VfsUtil.isAncestor(baseDir, file, false)) {
boolean isUnder = false;
for (VirtualFile c : myProjectRoots.getContentRoots()) {
if (!VfsUtil.isAncestor(baseDir, c, false) && VfsUtil.isAncestor(c, file, false)) {
isUnder = true;
break;
}
}
if (!isUnder) {
return false;
}
}
return true;
}
/**
* {@inheritDoc}
*/
@Override
public void fileCreated(VirtualFileEvent event) {
if (!myHasGitRoots.get()) {
return;
}
if (hasGitRepositories(event.getFile())) {
invalidate();
}
}
/**
* {@inheritDoc}
*/
@Override
public void beforeFileDeletion(VirtualFileEvent event) {
if (!myHasGitRoots.get()) {
return;
}
if (hasGitRepositories(event.getFile())) {
invalidate();
}
}
/**
* {@inheritDoc}
*/
@Override
public void fileMoved(VirtualFileMoveEvent event) {
if (!myHasGitRoots.get()) {
return;
}
if (hasGitRepositories(event.getFile())) {
invalidate();
}
}
/**
* {@inheritDoc}
*/
@Override
public void fileCopied(VirtualFileCopyEvent event) {
if (!myHasGitRoots.get()) {
return;
}
if (hasGitRepositories(event.getFile())) {
invalidate();
}
}
}
}
@@ -18,6 +18,7 @@ package git4idea.roots
import git4idea.test.GitMockVirtualFile
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.io.FileUtil
import git4idea.test.GitTestPlatformFacade
/**
*
@@ -25,17 +26,27 @@ import com.intellij.openapi.util.io.FileUtil
*/
class AbstractGitRootTest {
GitTestPlatformFacade myPlatformFacade
AbstractGitRootTest() {
myPlatformFacade = new GitTestPlatformFacade()
}
/**
* Creates the necessary temporary directories in the filesystem with empty ".git" directories for given roots.
* And creates an instance of the project.
* @param gitRoots path to actual .git roots, relative to the project dir.
*/
Project initProject(Collection<String> gitRoots, Collection<String> projectStructure) {
Project initProject(Collection<String> gitRoots, Collection<String> projectStructure, Collection<String> linkedRoots) {
String projectDir = createDirs(gitRoots)
Project project = [
getBaseDir: { new GitMockVirtualFile(projectDir) }
] as Project
createProjectStructure(project, projectStructure);
createProjectStructure(project, linkedRoots);
linkedRoots.each { myPlatformFacade.myProjectRootManager.myContentRoots << GitMockVirtualFile.fromPath(it, project)}
project
}
@@ -118,13 +118,40 @@ class GitRootDetectorTest extends AbstractGitRootTest {
below: false
}
@Test
void "linked source root alone should be detected"() {
doTest linked_roots: ["../linked_root"],
gits: ["../linked_root"],
expected: ["../linked_root"],
full: false,
below: false
}
@Test
void "linked source root and project root should be detected"() {
doTest linked_roots: ["../linked_root"],
gits: [".", "../linked_root"],
expected: [".", "../linked_root"],
full: true,
below: false
}
@Test
void "linked source below Git"() {
doTest linked_roots: ["../linked_root/src"],
gits: [".", "../linked_root"],
expected: [".", "../linked_root"],
full: true,
below: false
}
/**
* Perform test. Map contains actual Git repositories to be created on disk,
* and Git repositories expected to be detected by the GitRootDetector.
* @param map
*/
private void doTest(Map map) {
myProject = initProject(map.gits, map.project)
myProject = initProject(map.gits, map.project, map.linked_roots)
testInfo empty: map.expected.empty,
full : map.full,
roots: map.expected,
@@ -170,7 +197,7 @@ class GitRootDetectorTest extends AbstractGitRootTest {
}
private GitRootDetectInfo detect() {
new GitRootDetector(myProject).detect()
new GitRootDetector(myProject, myPlatformFacade).detect()
}
}
@@ -24,6 +24,7 @@ import org.junit.Test
import static git4idea.test.GitGTestUtil.toAbsolute
import static junit.framework.Assert.assertEquals
import git4idea.test.GitMockVirtualFile
import com.intellij.openapi.vcs.VcsRootError
/**
*
@@ -104,16 +105,16 @@ class GitRootErrorsFinderTest extends AbstractGitRootTest {
}
private void doTest(Map map) {
myProject = initProject(map.git, [])
myProject = initProject(map.git, [], [])
myVcsManager = (GitMockVcsManager) myPlatformFacade.getVcsManager(myProject)
addVcsRoots(map.roots)
Collection<GitRootError> expected = new ArrayList<GitRootError>();
Collection<VcsRootError> expected = new ArrayList<VcsRootError>();
expected.addAll map.errors.unreg.collect { unreg(it) }
expected.addAll map.errors.extra.collect { extra(it) }
Collection<GitRootError> actual = new GitRootErrorsFinder(myProject, myPlatformFacade).find()
Collection<VcsRootError> actual = new GitRootErrorsFinder(myProject, myPlatformFacade).find()
assertEquals expected.toSet(), actual.toSet()
}
@@ -124,12 +125,12 @@ class GitRootErrorsFinderTest extends AbstractGitRootTest {
}
}
GitRootError unreg(String path) {
return new GitRootError(GitRootError.Type.UNREGISTERED_ROOT, new GitMockVirtualFile(toAbsolute(path, myProject)))
VcsRootError unreg(String path) {
return new VcsRootError(VcsRootError.Type.UNREGISTERED_ROOT, new GitMockVirtualFile(toAbsolute(path, myProject)))
}
GitRootError extra(String path) {
return new GitRootError(GitRootError.Type.EXTRA_ROOT, new GitMockVirtualFile(toAbsolute(path, myProject)))
VcsRootError extra(String path) {
return new VcsRootError(VcsRootError.Type.EXTRA_ROOT, new GitMockVirtualFile(toAbsolute(path, myProject)))
}
@@ -0,0 +1,126 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.test
import com.intellij.openapi.Disposable
import com.intellij.openapi.module.ModifiableModuleModel
import com.intellij.openapi.module.Module
import com.intellij.openapi.projectRoots.Sdk
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.roots.*
/**
*
* @author Kirill Likhodedov
*/
class GitMockProjectRootManager extends ProjectRootManager {
Collection<VirtualFile> myContentRoots = new ArrayList<VirtualFile>();
GitMockProjectRootManager() {
}
@Override
VirtualFile[] getContentRoots() {
myContentRoots
}
@Override
ProjectFileIndex getFileIndex() {
throw new UnsupportedOperationException()
}
@Override
void addModuleRootListener(ModuleRootListener listener) {
throw new UnsupportedOperationException()
}
@Override
void addModuleRootListener(ModuleRootListener listener, Disposable parentDisposable) {
throw new UnsupportedOperationException()
}
@Override
void removeModuleRootListener(ModuleRootListener listener) {
throw new UnsupportedOperationException()
}
@Override
VirtualFile[] getFilesFromAllModules(OrderRootType type) {
throw new UnsupportedOperationException()
}
@Override
OrderEnumerator orderEntries() {
throw new UnsupportedOperationException()
}
@Override
OrderEnumerator orderEntries(Collection<? extends Module> modules) {
throw new UnsupportedOperationException()
}
@Override
VirtualFile[] getContentRootsFromAllModules() {
throw new UnsupportedOperationException()
}
@Override
List<String> getContentRootUrls() {
throw new UnsupportedOperationException()
}
@Override
VirtualFile[] getContentSourceRoots() {
throw new UnsupportedOperationException()
}
@Override
Sdk getProjectSdk() {
throw new UnsupportedOperationException()
}
@Override
String getProjectSdkName() {
throw new UnsupportedOperationException()
}
@Override
void setProjectSdk(Sdk sdk) {
throw new UnsupportedOperationException()
}
@Override
void setProjectSdkName(String name) {
throw new UnsupportedOperationException()
}
@Override
void multiCommit(ModifiableRootModel[] rootModels) {
throw new UnsupportedOperationException()
}
@Override
void multiCommit(ModifiableModuleModel moduleModel, ModifiableRootModel[] rootModels) {
throw new UnsupportedOperationException()
}
@Override
long getModificationCount() {
throw new UnsupportedOperationException()
}
}
@@ -15,12 +15,13 @@
*/
package git4idea.test
import com.intellij.mock.MockVirtualFileSystem
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileSystem
import org.jetbrains.annotations.NotNull
import org.jetbrains.annotations.Nullable
import com.intellij.mock.MockVirtualFileSystem
/**
* VirtualFile test implementation based on {@link java.io.File}.
@@ -31,6 +32,16 @@ class GitMockVirtualFile extends VirtualFile {
private String myPath;
@NotNull
static VirtualFile fromPath(@NotNull String absolutePath) {
return new GitMockVirtualFile(FileUtil.toSystemIndependentName(absolutePath))
}
@NotNull
static VirtualFile fromPath(@NotNull String relativePath, @NotNull Project project) {
return fromPath(new File(project.getBaseDir().getPath() + "/" + relativePath).getCanonicalPath())
}
GitMockVirtualFile(@NotNull String path) {
myPath = FileUtil.toSystemIndependentName(path);
}
@@ -133,4 +144,5 @@ class GitMockVirtualFile extends VirtualFile {
int hashCode() {
return (myPath != null ? myPath.hashCode() : 0)
}
}
@@ -23,6 +23,7 @@ import git4idea.Notificator
import git4idea.PlatformFacade
import git4idea.tests.TestDialogManager
import org.jetbrains.annotations.NotNull
import com.intellij.openapi.roots.ProjectRootManager
/**
*
@@ -34,10 +35,12 @@ public class GitTestPlatformFacade implements PlatformFacade {
GitMockVcs myVcs
TestNotificator myNotificator
TestDialogManager myTestDialogManager
GitMockProjectRootManager myProjectRootManager
public GitTestPlatformFacade() {
myVcsManager = new GitMockVcsManager()
myTestDialogManager = new TestDialogManager()
myProjectRootManager = new GitMockProjectRootManager()
}
@NotNull
@@ -60,6 +63,11 @@ public class GitTestPlatformFacade implements PlatformFacade {
myTestDialogManager.show(dialog)
}
@Override
ProjectRootManager getProjectRootManager(Project project) {
myProjectRootManager
}
@NotNull
@Override
AbstractVcs getVcs(@NotNull Project project) {
@@ -4,12 +4,15 @@ import com.intellij.codeInsight.hint.HintManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.JBPopupAdapter;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.treeStructure.Tree;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.sync.conflict.GradleConflictControlFactory;
import org.jetbrains.plugins.gradle.ui.GradleProjectStructureNode;
import org.jetbrains.plugins.gradle.ui.GradleUiListener;
import org.jetbrains.plugins.gradle.util.GradleBundle;
import org.jetbrains.plugins.gradle.util.GradleProjectStructureContext;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -68,6 +71,14 @@ public class GradleShowConflictDetailsAction extends AbstractGradleSyncTreeNodeA
}
final Point hintPosition = GradleUtil.getHintPosition(node, tree);
final Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(control).setFillColor(tree.getBackground()).createBalloon();
final GradleUiListener publisher = project.getMessageBus().syncPublisher(GradleUiListener.TOPIC);
publisher.beforeConflictUiShown();
balloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
publisher.afterConflictUiShown();
}
});
balloon.show(new RelativePoint(tree, hintPosition), Balloon.Position.below);
}
}
@@ -58,7 +58,8 @@ public class GradleConfigurable implements SearchableConfigurable, Configurable.
* This property has a form of 'not-propagate' in order to default to 'propagate'.
*/
@NonNls private static final String NOT_PROPAGATE_GRADLE_HOME_TO_DEFAULT_PROJECT = "gradle.not.propagate.home.to.default.project";
private static final long BALLOON_DELAY_MILLIS = TimeUnit.SECONDS.toMillis(1);
private final Alarm myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private final GradleLibraryManager myLibraryManager;
@@ -286,17 +287,25 @@ public class GradleConfigurable implements SearchableConfigurable, Configurable.
private class DelayedBalloonInfo implements Runnable {
private final MessageType myMessageType;
private final String myText;
private final long myTriggerTime;
DelayedBalloonInfo(@NotNull MessageType messageType, @NotNull GradleHomeSettingType settingType) {
myMessageType = messageType;
myText = settingType.getDescription();
myTriggerTime = System.currentTimeMillis() + BALLOON_DELAY_MILLIS;
}
@Override
public void run() {
long diff = myTriggerTime - System.currentTimeMillis();
if (diff > 0) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(this, diff);
return;
}
if (myGradleHomeComponent == null || !myGradleHomeComponent.getPathComponent().isShowing()) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(this, (int)TimeUnit.MILLISECONDS.toMillis(200));
myAlarm.addRequest(this, 200);
return;
}
GradleUtil.showBalloon(myGradleHomeComponent.getPathComponent(), myMessageType, myText);
@@ -21,6 +21,7 @@ import org.jetbrains.plugins.gradle.config.GradleToolWindowPanel;
import org.jetbrains.plugins.gradle.diff.GradleProjectStructureChange;
import org.jetbrains.plugins.gradle.ui.GradleDataKeys;
import org.jetbrains.plugins.gradle.ui.GradleProjectStructureNode;
import org.jetbrains.plugins.gradle.ui.GradleUiListener;
import org.jetbrains.plugins.gradle.util.GradleConstants;
import org.jetbrains.plugins.gradle.util.GradleProjectStructureContext;
import org.jetbrains.plugins.gradle.util.GradleUtil;
@@ -43,14 +44,19 @@ import java.util.List;
* @since 11/3/11 3:58 PM
*/
public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
private static final int TOOLTIP_DELAY_MILLIS = 500;
private final Alarm myToolbarAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private final Alarm myToolbarAppearanceAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private final Alarm myToolbarTrackingAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private Tree myTree;
private GradleProjectStructureTreeModel myTreeModel;
private GradleProjectStructureContext myContext;
private Object myNodeUnderMouse;
private Object myNodeWithActiveToolbar;
private Balloon myToolbar;
private boolean mySuppressToolbar;
public GradleProjectStructureChangesPanel(@NotNull Project project, @NotNull GradleProjectStructureContext context) {
super(project, GradleConstants.TOOL_WINDOW_TOOLBAR_PLACE);
@@ -93,7 +99,7 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
result.setBackground(myTree.getBackground());
CustomizationUtil.installPopupHandler(myTree, GradleConstants.ACTION_GROUP_SYNC_TREE, GradleConstants.SYNC_TREE_CONTEXT_MENU_PLACE);
setupActionHint();
setupToolbar();
return result;
}
@@ -103,13 +109,13 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
int i = 1;
}
private void setupActionHint() {
private void setupToolbar() {
final ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
actionManager.addAnActionListener(new AnActionListener.Adapter() {
@Override
public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
if (event != null && GradleConstants.SYNC_TREE_FLOATING_TOOLBAR_PLACE.equals(event.getPlace())) {
hideHint();
hideToolbar();
}
}
}, getProject());
@@ -124,59 +130,100 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
toolbarComponent.setBackground(myTree.getBackground());
myTree.addMouseMotionListener(new MouseMotionAdapter() {
Object activeNode;
@Override
public void mouseMoved(MouseEvent e) {
final TreePath path = myTree.getPathForLocation(e.getX(), e.getY());
if (path == null) {
hideHint();
return;
}
Balloon activeToolbar = myToolbar;
// Do nothing if the toolbar action selection is in progress.
if (activeToolbar instanceof IdeTooltip.Ui && ((IdeTooltip.Ui)(activeToolbar)).isInside(new RelativePoint(e))) {
return;
}
final Object node = path.getLastPathComponent();
final GradleProjectStructureNode<?> node = (GradleProjectStructureNode<?>)path.getLastPathComponent();
myNodeUnderMouse = node;
if (node == activeNode && activeToolbar != null && !activeToolbar.isDisposed()) {
return;
}
hideHint();
if (!actionManager.isActionPopupStackEmpty()) {
return;
}
toolbar.updateActionsImmediately();
if (!toolbar.hasVisibleActions()) {
activeNode = null;
return;
}
activeNode = node;
final Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(toolbarComponent)
.setFillColor(myTree.getBackground())
.createBalloon();
Disposer.register(getProject(), balloon);
Point hintPosition = GradleUtil.getHintPosition((GradleProjectStructureNode<?>)node, myTree);
myToolbar = balloon;
balloon.show(new RelativePoint(myTree, hintPosition), Balloon.Position.below);
startToolbarTracking();
scheduleToolbar(node, toolbar, toolbarComponent);
}
});
myTree.addMouseListener(new MouseAdapter() {
getProject().getMessageBus().connect(getProject()).subscribe(GradleUiListener.TOPIC, new GradleUiListener() {
@Override
public void mousePressed(MouseEvent e) {
hideHint();
public void beforeConflictUiShown() {
mySuppressToolbar = true;
hideToolbar();
}
@Override
public void afterConflictUiShown() {
mySuppressToolbar = false;
hideToolbar();
}
});
}
/**
* The general idea is to do the following:
* <pre>
* <ol>
* <li>Detected that the mouse is located over particular node;</li>
* <li>Show toolbar for the target node after particular delay;</li>
* </ol>
* </pre>
* <p/>
* This method schedules toolbar for the given node.
*
* @param node target node for which a toolbar should be shown
*/
private void scheduleToolbar(final @NotNull GradleProjectStructureNode<?> node,
final @NotNull ActionToolbar toolbar,
final @NotNull JComponent toolbarComponent)
{
if (mySuppressToolbar || node == myNodeWithActiveToolbar) {
return;
}
myToolbarAppearanceAlarm.cancelAllRequests();
myToolbarAppearanceAlarm.addRequest(new Runnable() {
@Override
public void run() {
if (myNodeUnderMouse != node) {
return;
}
final Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
SwingUtilities.convertPointFromScreen(mouseLocation, myTree);
final TreePath path = myTree.getPathForLocation(mouseLocation.x, mouseLocation.y);
if (path == null) {
hideToolbar();
return;
}
Balloon activeToolbar = myToolbar;
// Do nothing if the toolbar action selection is in progress.
if (activeToolbar instanceof IdeTooltip.Ui && ((IdeTooltip.Ui)(activeToolbar)).isInside(new RelativePoint(myTree, mouseLocation))) {
return;
}
hideToolbar();
final ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
if (!actionManager.isActionPopupStackEmpty()) {
hideToolbar();
return;
}
toolbar.updateActionsImmediately();
if (!toolbar.hasVisibleActions()) {
hideToolbar();
return;
}
final Balloon balloon = JBPopupFactory.getInstance().createBalloonBuilder(toolbarComponent)
.setFillColor(myTree.getBackground())
.createBalloon();
Disposer.register(getProject(), balloon);
Point hintPosition = GradleUtil.getHintPosition(node, myTree);
myToolbar = balloon;
myNodeWithActiveToolbar = node;
balloon.show(new RelativePoint(myTree, hintPosition), Balloon.Position.below);
startToolbarTracking();
}
}, TOOLTIP_DELAY_MILLIS);
}
private void startToolbarTracking() {
myToolbarAlarm.cancelAllRequests();
myToolbarTrackingAlarm.cancelAllRequests();
final int delayMillis = 300;
myToolbarAlarm.addRequest(new Runnable() {
myToolbarTrackingAlarm.addRequest(new Runnable() {
@Override
public void run() {
if (myToolbar == null) {
@@ -185,21 +232,23 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
final Point location = MouseInfo.getPointerInfo().getLocation();
SwingUtilities.convertPointFromScreen(location, GradleProjectStructureChangesPanel.this);
if (GradleProjectStructureChangesPanel.this.contains(location)) {
myToolbarAlarm.addRequest(this, delayMillis);
myToolbarTrackingAlarm.addRequest(this, delayMillis);
}
else {
hideHint();
hideToolbar();
}
}
}, delayMillis);
}
private void hideHint() {
private void hideToolbar() {
final Balloon toolbar = myToolbar;
myNodeWithActiveToolbar = null;
if (toolbar != null && !toolbar.isDisposed()) {
toolbar.hide();
myToolbar = null;
myToolbarAlarm.cancelAllRequests();
myToolbarAppearanceAlarm.cancelAllRequests();
myToolbarTrackingAlarm.cancelAllRequests();
}
}
@@ -221,7 +270,11 @@ public class GradleProjectStructureChangesPanel extends GradleToolWindowPanel {
return result;
}
else if (GradleDataKeys.SYNC_TREE_NODE_UNDER_MOUSE.is(dataId)) {
return myNodeUnderMouse;
Object result = myNodeWithActiveToolbar;
if (result == null) {
result = myNodeUnderMouse;
}
return result;
}
else {
return super.getData(dataId);
@@ -0,0 +1,23 @@
package org.jetbrains.plugins.gradle.ui;
import com.intellij.util.messages.Topic;
/**
* Defines various callbacks for the gradle integration UI processing.
* <p/>
* Implementations of this interface are not obliged to be thread-safe.
*
* @author Denis Zhdanov
* @since 3/6/12 11:59 AM
*/
public interface GradleUiListener {
Topic<GradleUiListener> TOPIC = Topic.create("Gradle UI", GradleUiListener.class);
/**
* Is called before conflict changes UI is shown.
*/
void beforeConflictUiShown();
void afterConflictUiShown();
}
@@ -29,6 +29,7 @@ import com.intellij.util.Consumer;
import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.GroovyIcons;
import org.jetbrains.plugins.groovy.lang.completion.GroovyCompletionUtil;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
@@ -351,7 +352,7 @@ public class CompleteReferenceExpression {
myMatcher = matcher;
myParameters = parameters;
myPreferredFieldNames = addAllRestrictedProperties(place);
mySkipPackages = PsiImplUtil.getRuntimeQualifier(place) == null;
mySkipPackages = shouldSkipPackages(place);
myEventListener = JavaPsiFacade.getInstance(place.getProject()).findClass("java.util.EventListener", place.getResolveScope());
myPropertyNames.addAll(addAllRestrictedProperties(place));
@@ -359,6 +360,15 @@ public class CompleteReferenceExpression {
myMethodPointerOperator = place.getDotTokenType() == GroovyTokenTypes.mMEMBER_POINTER;
}
private static boolean shouldSkipPackages(GrReferenceExpression place) {
if (PsiImplUtil.getRuntimeQualifier(place) != null) {
return false;
}
PsiElement parent = place.getParent();
return parent == null || parent.getLanguage().isKindOf(GroovyFileType.GROOVY_LANGUAGE); //don't skip in Play!
}
@Override
public boolean execute(PsiElement element, ResolveState state) {
if (element instanceof PsiMethod && ((PsiMethod)element).isConstructor()) return true;
@@ -591,41 +591,58 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
}
public SVNUpdateClient createUpdateClient() {
return new SVNUpdateClient(getPool(), myConfiguration.getOptions(myProject));
final SVNUpdateClient client = new SVNUpdateClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNStatusClient createStatusClient() {
SVNStatusClient client = new SVNStatusClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
client.setIgnoreExternals(true);
return client;
}
public SVNWCClient createWCClient() {
return new SVNWCClient(getPool(), myConfiguration.getOptions(myProject));
final SVNWCClient client = new SVNWCClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNCopyClient createCopyClient() {
return new SVNCopyClient(getPool(), myConfiguration.getOptions(myProject));
final SVNCopyClient client = new SVNCopyClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNMoveClient createMoveClient() {
return new SVNMoveClient(getPool(), myConfiguration.getOptions(myProject));
final SVNMoveClient client = new SVNMoveClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNLogClient createLogClient() {
return new SVNLogClient(getPool(), myConfiguration.getOptions(myProject));
final SVNLogClient client = new SVNLogClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNCommitClient createCommitClient() {
return new SVNCommitClient(getPool(), myConfiguration.getOptions(myProject));
final SVNCommitClient client = new SVNCommitClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNDiffClient createDiffClient() {
return new SVNDiffClient(getPool(), myConfiguration.getOptions(myProject));
final SVNDiffClient client = new SVNDiffClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNChangelistClient createChangelistClient() {
return new SVNChangelistClient(getPool(), myConfiguration.getOptions(myProject));
final SVNChangelistClient client = new SVNChangelistClient(getPool(), myConfiguration.getOptions(myProject));
client.getOperationsFactory().setAuthenticationManager(myConfiguration.getAuthenticationManager(this));
return client;
}
public SVNWCAccess createWCAccess() {
@@ -50,6 +50,7 @@ import org.jetbrains.idea.svn.*;
import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNCommitInfo;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.*;
import javax.swing.*;
@@ -175,17 +176,17 @@ public class SvnCheckinEnvironment implements CheckinEnvironment {
return Collections.singletonList(committables);
}
final MultiMap<File, File> result = new MultiMap<File, File>();
final MultiMap<SVNURL, File> result = new MultiMap<SVNURL, File>();
for (File committable : committables) {
final RootUrlInfo path = mySvnVcs.getSvnFileUrlMapping().getWcRootForFilePath(committable);
result.putValue(path == null ? null : path.getIoFile(), committable);
result.putValue(path == null ? null : path.getRepositoryUrlUrl(), committable);
}
if (result.size() == 1) {
return Collections.singletonList(committables);
}
final Collection<Collection<File>> result2 = new ArrayList<Collection<File>>();
for (Map.Entry<File, Collection<File>> entry : result.entrySet()) {
for (Map.Entry<SVNURL, Collection<File>> entry : result.entrySet()) {
result2.add(entry.getValue());
}
return result2;
@@ -14,6 +14,16 @@
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
<orderEntry type="module" module-name="tasks-api" />
<orderEntry type="library" name="http-client-3.1" level="project" />
<orderEntry type="module" module-name="tasks-core" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../tasks-core/lib/commons-discovery-0.4.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
@@ -0,0 +1,148 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* AbstractNamedRemoteEntity.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public abstract class AbstractNamedRemoteEntity extends AbstractRemoteEntity
implements java.io.Serializable {
private String name;
public AbstractNamedRemoteEntity() {
}
public AbstractNamedRemoteEntity(
String id,
String name) {
super(
id);
this.name = name;
}
/**
* Gets the name value for this AbstractNamedRemoteEntity.
*
* @return name
*/
public String getName() {
return name;
}
/**
* Sets the name value for this AbstractNamedRemoteEntity.
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof AbstractNamedRemoteEntity)) {
return false;
}
AbstractNamedRemoteEntity other = (AbstractNamedRemoteEntity) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.name == null && other.getName() == null) ||
(this.name != null &&
this.name.equals(other.getName())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getName() != null) {
_hashCode += getName().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(AbstractNamedRemoteEntity.class, true);
static {
typeDesc.setXmlType(
new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "AbstractNamedRemoteEntity"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("name");
elemField.setXmlName(new javax.xml.namespace.QName("", "name"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,170 @@
/**
* AbstractRemoteConstant.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public abstract class AbstractRemoteConstant extends AbstractNamedRemoteEntity
implements java.io.Serializable {
private String description;
private String icon;
public AbstractRemoteConstant() {
}
public AbstractRemoteConstant(
String id,
String name,
String description,
String icon) {
super(
id,
name);
this.description = description;
this.icon = icon;
}
/**
* Gets the description value for this AbstractRemoteConstant.
*
* @return description
*/
public String getDescription() {
return description;
}
/**
* Sets the description value for this AbstractRemoteConstant.
*
* @param description
*/
public void setDescription(String description) {
this.description = description;
}
/**
* Gets the icon value for this AbstractRemoteConstant.
*
* @return icon
*/
public String getIcon() {
return icon;
}
/**
* Sets the icon value for this AbstractRemoteConstant.
*
* @param icon
*/
public void setIcon(String icon) {
this.icon = icon;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof AbstractRemoteConstant)) {
return false;
}
AbstractRemoteConstant other = (AbstractRemoteConstant) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.description == null && other.getDescription() == null) ||
(this.description != null &&
this.description.equals(other.getDescription()))) &&
((this.icon == null && other.getIcon() == null) ||
(this.icon != null &&
this.icon.equals(other.getIcon())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getDescription() != null) {
_hashCode += getDescription().hashCode();
}
if (getIcon() != null) {
_hashCode += getIcon().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(AbstractRemoteConstant.class, true);
static {
typeDesc.setXmlType(
new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "AbstractRemoteConstant"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("description");
elemField.setXmlName(new javax.xml.namespace.QName("", "description"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("icon");
elemField.setXmlName(new javax.xml.namespace.QName("", "icon"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,127 @@
/**
* AbstractRemoteEntity.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public abstract class AbstractRemoteEntity implements java.io.Serializable {
private String id;
public AbstractRemoteEntity() {
}
public AbstractRemoteEntity(
String id) {
this.id = id;
}
/**
* Gets the id value for this AbstractRemoteEntity.
*
* @return id
*/
public String getId() {
return id;
}
/**
* Sets the id value for this AbstractRemoteEntity.
*
* @param id
*/
public void setId(String id) {
this.id = id;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof AbstractRemoteEntity)) {
return false;
}
AbstractRemoteEntity other = (AbstractRemoteEntity) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.id == null && other.getId() == null) ||
(this.id != null &&
this.id.equals(other.getId())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getId() != null) {
_hashCode += getId().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(AbstractRemoteEntity.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "AbstractRemoteEntity"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("id");
elemField.setXmlName(new javax.xml.namespace.QName("", "id"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,117 @@
/**
* IssueServiceImpl$RemoteWorklogImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class IssueServiceImpl$RemoteWorklogImpl extends RemoteWorklog
implements java.io.Serializable {
public IssueServiceImpl$RemoteWorklogImpl() {
}
public IssueServiceImpl$RemoteWorklogImpl(
String author,
String comment,
java.util.Calendar created,
String groupLevel,
String id,
String roleLevelId,
java.util.Calendar startDate,
String timeSpent,
long timeSpentInSeconds,
String updateAuthor,
java.util.Calendar updated) {
super(
author,
comment,
created,
groupLevel,
id,
roleLevelId,
startDate,
timeSpent,
timeSpentInSeconds,
updateAuthor,
updated);
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof IssueServiceImpl$RemoteWorklogImpl)) {
return false;
}
IssueServiceImpl$RemoteWorklogImpl other = (IssueServiceImpl$RemoteWorklogImpl) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj);
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(IssueServiceImpl$RemoteWorklogImpl.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://service.soap.rpc.jira.atlassian.com",
"IssueServiceImpl$RemoteWorklogImpl"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,495 @@
/**
* JiraSoapService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public interface JiraSoapService extends java.rmi.Remote {
public RemoteComment getComment(String in0, long in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteGroup createGroup(String in0, String in1,
RemoteUser in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteSecurityLevel getSecurityLevel(String in0,
String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteException;
public RemoteServerInfo getServerInfo(String in0)
throws java.rmi.RemoteException;
public RemoteGroup getGroup(String in0, String in1) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteUser createUser(String in0, String in1,
String in2, String in3, String in4) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteUser getUser(String in0, String in1) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException;
public String login(String in0, String in1) throws java.rmi.RemoteException,
RemoteAuthenticationException,
RemoteException;
public RemoteIssue getIssue(String in0, String in1) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteIssue createIssue(String in0,
RemoteIssue in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteNamedObject[] getAvailableActions(String in0,
String in1) throws java.rmi.RemoteException, RemoteException;
public RemoteIssue updateIssue(String in0, String in1,
RemoteFieldValue[] in2)
throws java.rmi.RemoteException, RemoteException;
public RemoteConfiguration getConfiguration(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteComponent[] getComponents(String in0,
String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteProject updateProject(String in0,
RemoteProject in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteProject getProjectByKey(String in0, String in1)
throws java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemotePriority[] getPriorities(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException;
public RemoteResolution[] getResolutions(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException;
public RemoteIssueType[] getIssueTypes(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException;
public RemoteStatus[] getStatuses(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException;
public RemoteIssueType[] getSubTaskIssueTypes(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException;
public RemoteProjectRole[] getProjectRoles(String in0)
throws java.rmi.RemoteException, RemoteException;
public RemoteProjectRole getProjectRole(String in0, long in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteProjectRoleActors getProjectRoleActors(String in0,
RemoteProjectRole in1,
RemoteProject in2)
throws java.rmi.RemoteException, RemoteException;
public RemoteRoleActors getDefaultRoleActors(String in0,
RemoteProjectRole in1)
throws java.rmi.RemoteException, RemoteException;
public void removeAllRoleActorsByNameAndType(String in0, String in1, String in2)
throws java.rmi.RemoteException, RemoteException;
public void removeAllRoleActorsByProject(String in0, RemoteProject in1)
throws java.rmi.RemoteException, RemoteException;
public void deleteProjectRole(String in0, RemoteProjectRole in1,
boolean in2) throws java.rmi.RemoteException, RemoteException;
public void updateProjectRole(String in0, RemoteProjectRole in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteProjectRole createProjectRole(String in0,
RemoteProjectRole in1)
throws java.rmi.RemoteException, RemoteException;
public boolean isProjectRoleNameUnique(String in0, String in1)
throws java.rmi.RemoteException, RemoteException;
public void addActorsToProjectRole(String in0, String[] in1,
RemoteProjectRole in2,
RemoteProject in3, String in4)
throws java.rmi.RemoteException, RemoteException;
public void removeActorsFromProjectRole(String in0, String[] in1,
RemoteProjectRole in2,
RemoteProject in3, String in4)
throws java.rmi.RemoteException, RemoteException;
public void addDefaultActorsToProjectRole(String in0, String[] in1,
RemoteProjectRole in2, String in3)
throws java.rmi.RemoteException, RemoteException;
public void removeDefaultActorsFromProjectRole(String in0, String[] in1,
RemoteProjectRole in2, String in3)
throws java.rmi.RemoteException, RemoteException;
public RemoteScheme[] getAssociatedNotificationSchemes(String in0,
RemoteProjectRole in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteScheme[] getAssociatedPermissionSchemes(String in0,
RemoteProjectRole in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteField[] getCustomFields(String in0)
throws java.rmi.RemoteException, RemoteException;
public RemoteComment[] getComments(String in0, String in1)
throws java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteFilter[] getFavouriteFilters(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public void archiveVersion(String in0, String in1, String in2, boolean in3)
throws java.rmi.RemoteException, RemoteException;
public RemoteVersion[] getVersions(String in0, String in1)
throws java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteProject createProject(String in0, String in1,
String in2, String in3, String in4, String in5,
RemotePermissionScheme in6,
RemoteScheme in7,
RemoteScheme in8) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public void addComment(String in0, String in1,
RemoteComment in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteField[] getFieldsForEdit(String in0, String in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteIssueType[] getIssueTypesForProject(String in0,
String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteAuthenticationException;
public RemoteIssueType[] getSubTaskIssueTypesForProject(String in0,
String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteAuthenticationException;
public void addUserToGroup(String in0, RemoteGroup in1,
RemoteUser in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public void removeUserFromGroup(String in0, RemoteGroup in1,
RemoteUser in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public boolean logout(String in0) throws java.rmi.RemoteException;
public RemoteProject getProjectById(String in0, long in1) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteProject getProjectWithSchemesById(String in0, long in1)
throws java.rmi.RemoteException, RemoteException;
public void deleteProject(String in0, String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public void releaseVersion(String in0, String in1,
RemoteVersion in2)
throws java.rmi.RemoteException, RemoteException;
public RemoteSecurityLevel[] getSecurityLevels(String in0,
String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteException;
public void deleteIssue(String in0, String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteIssue createIssueWithSecurityLevel(String in0,
RemoteIssue in1, long in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public boolean addAttachmentsToIssue(String in0, String in1, String[] in2, byte[][] in3)
throws java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteAttachment[] getAttachmentsFromIssue(String in0,
String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public boolean hasPermissionToEditComment(String in0,
RemoteComment in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteComment editComment(String in0,
RemoteComment in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteField[] getFieldsForAction(String in0,
String in1, String in2)
throws java.rmi.RemoteException, RemoteException;
public RemoteIssue progressWorkflowAction(String in0,
String in1, String in2, RemoteFieldValue[] in3)
throws java.rmi.RemoteException, RemoteException;
public RemoteIssue getIssueById(String in0, String in1)
throws java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteWorklog addWorklogWithNewRemainingEstimate(String in0,
String in1, RemoteWorklog in2, String in3) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteException;
public RemoteWorklog addWorklogAndAutoAdjustRemainingEstimate(
String in0, String in1, RemoteWorklog in2) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteException;
public RemoteWorklog addWorklogAndRetainRemainingEstimate(String in0,
String in1, RemoteWorklog in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteException;
public void deleteWorklogWithNewRemainingEstimate(String in0, String in1, String in2) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteException;
public void deleteWorklogAndAutoAdjustRemainingEstimate(String in0, String in1) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteException;
public void deleteWorklogAndRetainRemainingEstimate(String in0, String in1) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteException;
public void updateWorklogWithNewRemainingEstimate(String in0,
RemoteWorklog in1, String in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteException;
public void updateWorklogAndAutoAdjustRemainingEstimate(String in0,
RemoteWorklog in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteException;
public void updateWorklogAndRetainRemainingEstimate(String in0,
RemoteWorklog in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteException;
public RemoteWorklog[] getWorklogs(String in0, String in1)
throws java.rmi.RemoteException, RemotePermissionException,
RemoteValidationException,
RemoteException;
public boolean hasPermissionToCreateWorklog(String in0, String in1) throws java.rmi.RemoteException,
RemoteValidationException,
RemoteException;
public boolean hasPermissionToDeleteWorklog(String in0, String in1) throws java.rmi.RemoteException,
RemoteValidationException,
RemoteException;
public boolean hasPermissionToUpdateWorklog(String in0, String in1) throws java.rmi.RemoteException,
RemoteValidationException,
RemoteException;
public RemoteScheme[] getNotificationSchemes(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemotePermissionScheme[] getPermissionSchemes(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemotePermissionScheme createPermissionScheme(String in0,
String in1, String in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public void deletePermissionScheme(String in0, String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemotePermissionScheme addPermissionTo(String in0,
RemotePermissionScheme in1,
RemotePermission in2,
RemoteEntity in3) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemotePermissionScheme deletePermissionFrom(String in0,
RemotePermissionScheme in1,
RemotePermission in2,
RemoteEntity in3) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemotePermission[] getAllPermissions(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public long getIssueCountForFilter(String in0, String in1)
throws java.rmi.RemoteException, RemoteException;
public RemoteIssue[] getIssuesFromTextSearch(String in0,
String in1) throws java.rmi.RemoteException, RemoteException;
public RemoteIssue[] getIssuesFromTextSearchWithProject(String in0,
String[] in1, String in2, int in3)
throws java.rmi.RemoteException, RemoteException;
public void deleteUser(String in0, String in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteGroup updateGroup(String in0,
RemoteGroup in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public void deleteGroup(String in0, String in1, String in2) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public void refreshCustomFields(String in0)
throws java.rmi.RemoteException, RemoteException;
public RemoteProject[] getProjectsNoSchemes(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteVersion addVersion(String in0, String in1,
RemoteVersion in2)
throws java.rmi.RemoteException, RemoteException;
public RemoteFilter[] getSavedFilters(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public boolean addBase64EncodedAttachmentsToIssue(String in0, String in1, String[] in2,
String[] in3) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteProject createProjectFromObject(String in0,
RemoteProject in1) throws java.rmi.RemoteException,
RemotePermissionException,
RemoteValidationException,
RemoteAuthenticationException,
RemoteException;
public RemoteScheme[] getSecuritySchemes(String in0) throws
java.rmi.RemoteException, RemotePermissionException,
RemoteAuthenticationException,
RemoteException;
public RemoteIssue[] getIssuesFromFilter(String in0,
String in1) throws java.rmi.RemoteException, RemoteException;
public RemoteIssue[] getIssuesFromFilterWithLimit(String in0,
String in1, int in2, int in3)
throws java.rmi.RemoteException, RemoteException;
public RemoteIssue[] getIssuesFromTextSearchWithLimit(String in0,
String in1, int in2, int in3)
throws java.rmi.RemoteException, RemoteException;
}
@@ -0,0 +1,18 @@
/**
* JiraSoapServiceService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public interface JiraSoapServiceService extends javax.xml.rpc.Service {
public String getJirasoapserviceV2Address();
public JiraSoapService getJirasoapserviceV2()
throws javax.xml.rpc.ServiceException;
public JiraSoapService getJirasoapserviceV2(java.net.URL portAddress)
throws javax.xml.rpc.ServiceException;
}
@@ -0,0 +1,179 @@
/**
* JiraSoapServiceServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
import org.apache.axis.EngineConfiguration;
public class JiraSoapServiceServiceLocator extends org.apache.axis.client.Service
implements JiraSoapServiceService {
public JiraSoapServiceServiceLocator() {
}
public JiraSoapServiceServiceLocator(EngineConfiguration config) {
super(config);
}
public JiraSoapServiceServiceLocator(String wsdlLoc, javax.xml.namespace.QName sName)
throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for JirasoapserviceV2
private String JirasoapserviceV2_address = "http://jira.atlassian.com/rpc/soap/jirasoapservice-v2";
public String getJirasoapserviceV2Address() {
return JirasoapserviceV2_address;
}
// The WSDD service name defaults to the port name.
private String JirasoapserviceV2WSDDServiceName = "jirasoapservice-v2";
public String getJirasoapserviceV2WSDDServiceName() {
return JirasoapserviceV2WSDDServiceName;
}
public void setJirasoapserviceV2WSDDServiceName(String name) {
JirasoapserviceV2WSDDServiceName = name;
}
/*
overiden configuration from file client-config.wsdd
* */
@Override
protected EngineConfiguration getEngineConfiguration() {
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<deployment name=\"defaultClientConfig\"\n"
+ " xmlns=\"http://xml.apache.org/axis/wsdd/\"\n"
+ " xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">\n"
+ " <globalConfiguration>\n"
+ " <parameter name=\"disablePrettyXML\" value=\"true\"/>\n"
+ " <parameter name=\"enableNamespacePrefixOptimization\" value=\"false\"/>\n"
+ " </globalConfiguration>");
sb.append("<transport name=\"http\" pivot=\"java:").append(org.apache.axis.transport.http.HTTPSender.class.getName()).append("\" />\r\n");
sb.append("<transport name=\"local\" pivot=\"java:").append(org.apache.axis.transport.local.LocalSender.class.getName()).append("\" />\r\n");
sb.append("<transport name=\"java\" pivot=\"java:").append(org.apache.axis.transport.java.JavaSender.class.getName()).append("\" />\r\n");
sb.append("</deployment>\r\n");
org.apache.axis.configuration.XMLStringProvider config =
new org.apache.axis.configuration.XMLStringProvider(sb.toString());
return config;
}
public JiraSoapService getJirasoapserviceV2()
throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(JirasoapserviceV2_address);
} catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getJirasoapserviceV2(endpoint);
}
public JiraSoapService getJirasoapserviceV2(java.net.URL portAddress)
throws javax.xml.rpc.ServiceException {
try {
JirasoapserviceV2SoapBindingStub _stub
= new JirasoapserviceV2SoapBindingStub(portAddress,
this);
_stub.setPortName(getJirasoapserviceV2WSDDServiceName());
return _stub;
} catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setJirasoapserviceV2EndpointAddress(String address) {
JirasoapserviceV2_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (JiraSoapService.class
.isAssignableFrom(serviceEndpointInterface)) {
JirasoapserviceV2SoapBindingStub _stub
= new JirasoapserviceV2SoapBindingStub(
new java.net.URL(JirasoapserviceV2_address), this);
_stub.setPortName(getJirasoapserviceV2WSDDServiceName());
return _stub;
}
} catch (Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " +
(serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface)
throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
String inputPortName = portName.getLocalPart();
if ("jirasoapservice-v2".equals(inputPortName)) {
return getJirasoapserviceV2();
} else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("http://jira.atlassian.com/rpc/soap/jirasoapservice-v2",
"JiraSoapServiceService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("http://jira.atlassian.com/rpc/soap/jirasoapservice-v2",
"jirasoapservice-v2"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(String portName, String address)
throws javax.xml.rpc.ServiceException {
if ("JirasoapserviceV2".equals(portName)) {
setJirasoapserviceV2EndpointAddress(address);
} else { // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, String address)
throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}
@@ -0,0 +1,275 @@
/**
* RemoteAttachment.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteAttachment extends AbstractRemoteEntity
implements java.io.Serializable {
private String author;
private java.util.Calendar created;
private String filename;
private Long filesize;
private String mimetype;
public RemoteAttachment() {
}
public RemoteAttachment(
String id,
String author,
java.util.Calendar created,
String filename,
Long filesize,
String mimetype) {
super(
id);
this.author = author;
this.created = created;
this.filename = filename;
this.filesize = filesize;
this.mimetype = mimetype;
}
/**
* Gets the author value for this RemoteAttachment.
*
* @return author
*/
public String getAuthor() {
return author;
}
/**
* Sets the author value for this RemoteAttachment.
*
* @param author
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* Gets the created value for this RemoteAttachment.
*
* @return created
*/
public java.util.Calendar getCreated() {
return created;
}
/**
* Sets the created value for this RemoteAttachment.
*
* @param created
*/
public void setCreated(java.util.Calendar created) {
this.created = created;
}
/**
* Gets the filename value for this RemoteAttachment.
*
* @return filename
*/
public String getFilename() {
return filename;
}
/**
* Sets the filename value for this RemoteAttachment.
*
* @param filename
*/
public void setFilename(String filename) {
this.filename = filename;
}
/**
* Gets the filesize value for this RemoteAttachment.
*
* @return filesize
*/
public Long getFilesize() {
return filesize;
}
/**
* Sets the filesize value for this RemoteAttachment.
*
* @param filesize
*/
public void setFilesize(Long filesize) {
this.filesize = filesize;
}
/**
* Gets the mimetype value for this RemoteAttachment.
*
* @return mimetype
*/
public String getMimetype() {
return mimetype;
}
/**
* Sets the mimetype value for this RemoteAttachment.
*
* @param mimetype
*/
public void setMimetype(String mimetype) {
this.mimetype = mimetype;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteAttachment)) {
return false;
}
RemoteAttachment other = (RemoteAttachment) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.author == null && other.getAuthor() == null) ||
(this.author != null &&
this.author.equals(other.getAuthor()))) &&
((this.created == null && other.getCreated() == null) ||
(this.created != null &&
this.created.equals(other.getCreated()))) &&
((this.filename == null && other.getFilename() == null) ||
(this.filename != null &&
this.filename.equals(other.getFilename()))) &&
((this.filesize == null && other.getFilesize() == null) ||
(this.filesize != null &&
this.filesize.equals(other.getFilesize()))) &&
((this.mimetype == null && other.getMimetype() == null) ||
(this.mimetype != null &&
this.mimetype.equals(other.getMimetype())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getAuthor() != null) {
_hashCode += getAuthor().hashCode();
}
if (getCreated() != null) {
_hashCode += getCreated().hashCode();
}
if (getFilename() != null) {
_hashCode += getFilename().hashCode();
}
if (getFilesize() != null) {
_hashCode += getFilesize().hashCode();
}
if (getMimetype() != null) {
_hashCode += getMimetype().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteAttachment.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "RemoteAttachment"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("author");
elemField.setXmlName(new javax.xml.namespace.QName("", "author"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("created");
elemField.setXmlName(new javax.xml.namespace.QName("", "created"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("filename");
elemField.setXmlName(new javax.xml.namespace.QName("", "filename"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("filesize");
elemField.setXmlName(new javax.xml.namespace.QName("", "filesize"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("mimetype");
elemField.setXmlName(new javax.xml.namespace.QName("", "mimetype"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,98 @@
/**
* RemoteAuthenticationException.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteAuthenticationException extends RemoteException
implements java.io.Serializable {
public RemoteAuthenticationException() {
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteAuthenticationException)) {
return false;
}
RemoteAuthenticationException other = (RemoteAuthenticationException) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj);
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteAuthenticationException.class, true);
static {
typeDesc.setXmlType(
new javax.xml.namespace.QName("http://exception.rpc.jira.atlassian.com", "RemoteAuthenticationException"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
/**
* Writes the exception data to the faultDetails
*/
public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context)
throws java.io.IOException {
context.serialize(qname, null, this);
}
}
@@ -0,0 +1,379 @@
/**
* RemoteComment.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteComment implements java.io.Serializable {
private String author;
private String body;
private java.util.Calendar created;
private String groupLevel;
private String id;
private String roleLevel;
private String updateAuthor;
private java.util.Calendar updated;
public RemoteComment() {
}
public RemoteComment(
String author,
String body,
java.util.Calendar created,
String groupLevel,
String id,
String roleLevel,
String updateAuthor,
java.util.Calendar updated) {
this.author = author;
this.body = body;
this.created = created;
this.groupLevel = groupLevel;
this.id = id;
this.roleLevel = roleLevel;
this.updateAuthor = updateAuthor;
this.updated = updated;
}
/**
* Gets the author value for this RemoteComment.
*
* @return author
*/
public String getAuthor() {
return author;
}
/**
* Sets the author value for this RemoteComment.
*
* @param author
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* Gets the body value for this RemoteComment.
*
* @return body
*/
public String getBody() {
return body;
}
/**
* Sets the body value for this RemoteComment.
*
* @param body
*/
public void setBody(String body) {
this.body = body;
}
/**
* Gets the created value for this RemoteComment.
*
* @return created
*/
public java.util.Calendar getCreated() {
return created;
}
/**
* Sets the created value for this RemoteComment.
*
* @param created
*/
public void setCreated(java.util.Calendar created) {
this.created = created;
}
/**
* Gets the groupLevel value for this RemoteComment.
*
* @return groupLevel
*/
public String getGroupLevel() {
return groupLevel;
}
/**
* Sets the groupLevel value for this RemoteComment.
*
* @param groupLevel
*/
public void setGroupLevel(String groupLevel) {
this.groupLevel = groupLevel;
}
/**
* Gets the id value for this RemoteComment.
*
* @return id
*/
public String getId() {
return id;
}
/**
* Sets the id value for this RemoteComment.
*
* @param id
*/
public void setId(String id) {
this.id = id;
}
/**
* Gets the roleLevel value for this RemoteComment.
*
* @return roleLevel
*/
public String getRoleLevel() {
return roleLevel;
}
/**
* Sets the roleLevel value for this RemoteComment.
*
* @param roleLevel
*/
public void setRoleLevel(String roleLevel) {
this.roleLevel = roleLevel;
}
/**
* Gets the updateAuthor value for this RemoteComment.
*
* @return updateAuthor
*/
public String getUpdateAuthor() {
return updateAuthor;
}
/**
* Sets the updateAuthor value for this RemoteComment.
*
* @param updateAuthor
*/
public void setUpdateAuthor(String updateAuthor) {
this.updateAuthor = updateAuthor;
}
/**
* Gets the updated value for this RemoteComment.
*
* @return updated
*/
public java.util.Calendar getUpdated() {
return updated;
}
/**
* Sets the updated value for this RemoteComment.
*
* @param updated
*/
public void setUpdated(java.util.Calendar updated) {
this.updated = updated;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteComment)) {
return false;
}
RemoteComment other = (RemoteComment) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.author == null && other.getAuthor() == null) ||
(this.author != null &&
this.author.equals(other.getAuthor()))) &&
((this.body == null && other.getBody() == null) ||
(this.body != null &&
this.body.equals(other.getBody()))) &&
((this.created == null && other.getCreated() == null) ||
(this.created != null &&
this.created.equals(other.getCreated()))) &&
((this.groupLevel == null && other.getGroupLevel() == null) ||
(this.groupLevel != null &&
this.groupLevel.equals(other.getGroupLevel()))) &&
((this.id == null && other.getId() == null) ||
(this.id != null &&
this.id.equals(other.getId()))) &&
((this.roleLevel == null && other.getRoleLevel() == null) ||
(this.roleLevel != null &&
this.roleLevel.equals(other.getRoleLevel()))) &&
((this.updateAuthor == null && other.getUpdateAuthor() == null) ||
(this.updateAuthor != null &&
this.updateAuthor.equals(other.getUpdateAuthor()))) &&
((this.updated == null && other.getUpdated() == null) ||
(this.updated != null &&
this.updated.equals(other.getUpdated())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getAuthor() != null) {
_hashCode += getAuthor().hashCode();
}
if (getBody() != null) {
_hashCode += getBody().hashCode();
}
if (getCreated() != null) {
_hashCode += getCreated().hashCode();
}
if (getGroupLevel() != null) {
_hashCode += getGroupLevel().hashCode();
}
if (getId() != null) {
_hashCode += getId().hashCode();
}
if (getRoleLevel() != null) {
_hashCode += getRoleLevel().hashCode();
}
if (getUpdateAuthor() != null) {
_hashCode += getUpdateAuthor().hashCode();
}
if (getUpdated() != null) {
_hashCode += getUpdated().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteComment.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "RemoteComment"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("author");
elemField.setXmlName(new javax.xml.namespace.QName("", "author"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("body");
elemField.setXmlName(new javax.xml.namespace.QName("", "body"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("created");
elemField.setXmlName(new javax.xml.namespace.QName("", "created"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("groupLevel");
elemField.setXmlName(new javax.xml.namespace.QName("", "groupLevel"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("id");
elemField.setXmlName(new javax.xml.namespace.QName("", "id"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("roleLevel");
elemField.setXmlName(new javax.xml.namespace.QName("", "roleLevel"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("updateAuthor");
elemField.setXmlName(new javax.xml.namespace.QName("", "updateAuthor"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("updated");
elemField.setXmlName(new javax.xml.namespace.QName("", "updated"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "dateTime"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,97 @@
/**
* RemoteComponent.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteComponent extends AbstractNamedRemoteEntity
implements java.io.Serializable {
public RemoteComponent() {
}
public RemoteComponent(
String id,
String name) {
super(
id,
name);
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteComponent)) {
return false;
}
RemoteComponent other = (RemoteComponent) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj);
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteComponent.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "RemoteComponent"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,411 @@
/**
* RemoteConfiguration.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteConfiguration implements java.io.Serializable {
private boolean allowAttachments;
private boolean allowExternalUserManagment;
private boolean allowIssueLinking;
private boolean allowSubTasks;
private boolean allowTimeTracking;
private boolean allowUnassignedIssues;
private boolean allowVoting;
private boolean allowWatching;
private int timeTrackingDaysPerWeek;
private int timeTrackingHoursPerDay;
public RemoteConfiguration() {
}
public RemoteConfiguration(
boolean allowAttachments,
boolean allowExternalUserManagment,
boolean allowIssueLinking,
boolean allowSubTasks,
boolean allowTimeTracking,
boolean allowUnassignedIssues,
boolean allowVoting,
boolean allowWatching,
int timeTrackingDaysPerWeek,
int timeTrackingHoursPerDay) {
this.allowAttachments = allowAttachments;
this.allowExternalUserManagment = allowExternalUserManagment;
this.allowIssueLinking = allowIssueLinking;
this.allowSubTasks = allowSubTasks;
this.allowTimeTracking = allowTimeTracking;
this.allowUnassignedIssues = allowUnassignedIssues;
this.allowVoting = allowVoting;
this.allowWatching = allowWatching;
this.timeTrackingDaysPerWeek = timeTrackingDaysPerWeek;
this.timeTrackingHoursPerDay = timeTrackingHoursPerDay;
}
/**
* Gets the allowAttachments value for this RemoteConfiguration.
*
* @return allowAttachments
*/
public boolean isAllowAttachments() {
return allowAttachments;
}
/**
* Sets the allowAttachments value for this RemoteConfiguration.
*
* @param allowAttachments
*/
public void setAllowAttachments(boolean allowAttachments) {
this.allowAttachments = allowAttachments;
}
/**
* Gets the allowExternalUserManagment value for this RemoteConfiguration.
*
* @return allowExternalUserManagment
*/
public boolean isAllowExternalUserManagment() {
return allowExternalUserManagment;
}
/**
* Sets the allowExternalUserManagment value for this RemoteConfiguration.
*
* @param allowExternalUserManagment
*/
public void setAllowExternalUserManagment(boolean allowExternalUserManagment) {
this.allowExternalUserManagment = allowExternalUserManagment;
}
/**
* Gets the allowIssueLinking value for this RemoteConfiguration.
*
* @return allowIssueLinking
*/
public boolean isAllowIssueLinking() {
return allowIssueLinking;
}
/**
* Sets the allowIssueLinking value for this RemoteConfiguration.
*
* @param allowIssueLinking
*/
public void setAllowIssueLinking(boolean allowIssueLinking) {
this.allowIssueLinking = allowIssueLinking;
}
/**
* Gets the allowSubTasks value for this RemoteConfiguration.
*
* @return allowSubTasks
*/
public boolean isAllowSubTasks() {
return allowSubTasks;
}
/**
* Sets the allowSubTasks value for this RemoteConfiguration.
*
* @param allowSubTasks
*/
public void setAllowSubTasks(boolean allowSubTasks) {
this.allowSubTasks = allowSubTasks;
}
/**
* Gets the allowTimeTracking value for this RemoteConfiguration.
*
* @return allowTimeTracking
*/
public boolean isAllowTimeTracking() {
return allowTimeTracking;
}
/**
* Sets the allowTimeTracking value for this RemoteConfiguration.
*
* @param allowTimeTracking
*/
public void setAllowTimeTracking(boolean allowTimeTracking) {
this.allowTimeTracking = allowTimeTracking;
}
/**
* Gets the allowUnassignedIssues value for this RemoteConfiguration.
*
* @return allowUnassignedIssues
*/
public boolean isAllowUnassignedIssues() {
return allowUnassignedIssues;
}
/**
* Sets the allowUnassignedIssues value for this RemoteConfiguration.
*
* @param allowUnassignedIssues
*/
public void setAllowUnassignedIssues(boolean allowUnassignedIssues) {
this.allowUnassignedIssues = allowUnassignedIssues;
}
/**
* Gets the allowVoting value for this RemoteConfiguration.
*
* @return allowVoting
*/
public boolean isAllowVoting() {
return allowVoting;
}
/**
* Sets the allowVoting value for this RemoteConfiguration.
*
* @param allowVoting
*/
public void setAllowVoting(boolean allowVoting) {
this.allowVoting = allowVoting;
}
/**
* Gets the allowWatching value for this RemoteConfiguration.
*
* @return allowWatching
*/
public boolean isAllowWatching() {
return allowWatching;
}
/**
* Sets the allowWatching value for this RemoteConfiguration.
*
* @param allowWatching
*/
public void setAllowWatching(boolean allowWatching) {
this.allowWatching = allowWatching;
}
/**
* Gets the timeTrackingDaysPerWeek value for this RemoteConfiguration.
*
* @return timeTrackingDaysPerWeek
*/
public int getTimeTrackingDaysPerWeek() {
return timeTrackingDaysPerWeek;
}
/**
* Sets the timeTrackingDaysPerWeek value for this RemoteConfiguration.
*
* @param timeTrackingDaysPerWeek
*/
public void setTimeTrackingDaysPerWeek(int timeTrackingDaysPerWeek) {
this.timeTrackingDaysPerWeek = timeTrackingDaysPerWeek;
}
/**
* Gets the timeTrackingHoursPerDay value for this RemoteConfiguration.
*
* @return timeTrackingHoursPerDay
*/
public int getTimeTrackingHoursPerDay() {
return timeTrackingHoursPerDay;
}
/**
* Sets the timeTrackingHoursPerDay value for this RemoteConfiguration.
*
* @param timeTrackingHoursPerDay
*/
public void setTimeTrackingHoursPerDay(int timeTrackingHoursPerDay) {
this.timeTrackingHoursPerDay = timeTrackingHoursPerDay;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteConfiguration)) {
return false;
}
RemoteConfiguration other = (RemoteConfiguration) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
this.allowAttachments == other.isAllowAttachments() &&
this.allowExternalUserManagment == other.isAllowExternalUserManagment() &&
this.allowIssueLinking == other.isAllowIssueLinking() &&
this.allowSubTasks == other.isAllowSubTasks() &&
this.allowTimeTracking == other.isAllowTimeTracking() &&
this.allowUnassignedIssues == other.isAllowUnassignedIssues() &&
this.allowVoting == other.isAllowVoting() &&
this.allowWatching == other.isAllowWatching() &&
this.timeTrackingDaysPerWeek == other.getTimeTrackingDaysPerWeek() &&
this.timeTrackingHoursPerDay == other.getTimeTrackingHoursPerDay();
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
_hashCode += (isAllowAttachments() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowExternalUserManagment() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowIssueLinking() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowSubTasks() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowTimeTracking() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowUnassignedIssues() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowVoting() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += (isAllowWatching() ? Boolean.TRUE : Boolean.FALSE).hashCode();
_hashCode += getTimeTrackingDaysPerWeek();
_hashCode += getTimeTrackingHoursPerDay();
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteConfiguration.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "RemoteConfiguration"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowAttachments");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowAttachments"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowExternalUserManagment");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowExternalUserManagment"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowIssueLinking");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowIssueLinking"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowSubTasks");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowSubTasks"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowTimeTracking");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowTimeTracking"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowUnassignedIssues");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowUnassignedIssues"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowVoting");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowVoting"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("allowWatching");
elemField.setXmlName(new javax.xml.namespace.QName("", "allowWatching"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("timeTrackingDaysPerWeek");
elemField.setXmlName(new javax.xml.namespace.QName("", "timeTrackingDaysPerWeek"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("timeTrackingHoursPerDay");
elemField.setXmlName(new javax.xml.namespace.QName("", "timeTrackingHoursPerDay"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,208 @@
/**
* RemoteCustomFieldValue.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteCustomFieldValue implements java.io.Serializable {
private String customfieldId;
private String key;
private String[] values;
public RemoteCustomFieldValue() {
}
public RemoteCustomFieldValue(
String customfieldId,
String key,
String[] values) {
this.customfieldId = customfieldId;
this.key = key;
this.values = values;
}
/**
* Gets the customfieldId value for this RemoteCustomFieldValue.
*
* @return customfieldId
*/
public String getCustomfieldId() {
return customfieldId;
}
/**
* Sets the customfieldId value for this RemoteCustomFieldValue.
*
* @param customfieldId
*/
public void setCustomfieldId(String customfieldId) {
this.customfieldId = customfieldId;
}
/**
* Gets the key value for this RemoteCustomFieldValue.
*
* @return key
*/
public String getKey() {
return key;
}
/**
* Sets the key value for this RemoteCustomFieldValue.
*
* @param key
*/
public void setKey(String key) {
this.key = key;
}
/**
* Gets the values value for this RemoteCustomFieldValue.
*
* @return values
*/
public String[] getValues() {
return values;
}
/**
* Sets the values value for this RemoteCustomFieldValue.
*
* @param values
*/
public void setValues(String[] values) {
this.values = values;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteCustomFieldValue)) {
return false;
}
RemoteCustomFieldValue other = (RemoteCustomFieldValue) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.customfieldId == null && other.getCustomfieldId() == null) ||
(this.customfieldId != null &&
this.customfieldId.equals(other.getCustomfieldId()))) &&
((this.key == null && other.getKey() == null) ||
(this.key != null &&
this.key.equals(other.getKey()))) &&
((this.values == null && other.getValues() == null) ||
(this.values != null &&
java.util.Arrays.equals(this.values, other.getValues())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getCustomfieldId() != null) {
_hashCode += getCustomfieldId().hashCode();
}
if (getKey() != null) {
_hashCode += getKey().hashCode();
}
if (getValues() != null) {
for (int i = 0;
i < java.lang.reflect.Array.getLength(getValues());
i++) {
Object obj = java.lang.reflect.Array.get(getValues(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteCustomFieldValue.class, true);
static {
typeDesc.setXmlType(
new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "RemoteCustomFieldValue"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("customfieldId");
elemField.setXmlName(new javax.xml.namespace.QName("", "customfieldId"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("key");
elemField.setXmlName(new javax.xml.namespace.QName("", "key"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("values");
elemField.setXmlName(new javax.xml.namespace.QName("", "values"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(true);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,88 @@
/**
* RemoteEntity.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteEntity implements java.io.Serializable {
public RemoteEntity() {
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteEntity)) {
return false;
}
RemoteEntity other = (RemoteEntity) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true;
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteEntity.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://beans.soap.rpc.jira.atlassian.com", "RemoteEntity"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
@@ -0,0 +1,96 @@
/**
* RemoteException.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.atlassian.connector.commons.jira.soap.axis;
public class RemoteException extends org.apache.axis.AxisFault implements java.io.Serializable {
public RemoteException() {
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RemoteException)) {
return false;
}
RemoteException other = (RemoteException) obj;
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true;
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RemoteException.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://exception.rpc.jira.atlassian.com", "RemoteException"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
/**
* Writes the exception data to the faultDetails
*/
public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context)
throws java.io.IOException {
context.serialize(qname, null, this);
}
}

Some files were not shown because too many files have changed in this diff Show More