This commit is contained in:
Dmitry Lomov
2012-05-22 17:42:36 +02:00
139 changed files with 1079 additions and 704 deletions
@@ -285,7 +285,7 @@ public class ArtifactManagerImpl extends ArtifactManager implements ProjectCompo
ContainerUtil.addIfNotNull(request, requestsToRemove);
}
Set<LocalFileSystem.WatchRequest> newRequests = LocalFileSystem.getInstance().replaceWatchedRoots(requestsToRemove, toAdd, true);
Set<LocalFileSystem.WatchRequest> newRequests = LocalFileSystem.getInstance().replaceWatchedRoots(requestsToRemove, toAdd, null);
for (LocalFileSystem.WatchRequest request : newRequests) {
myWatchedOutputs.put(request.getRootPath(), request);
}
@@ -29,8 +29,6 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.engine.evaluation.TextWithImports;
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilderImpl;
import com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator;
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
@@ -523,15 +521,7 @@ public class FrameVariablesTree extends DebuggerTree {
boolean isConstant = (var instanceof PsiEnumConstant) ||
(modifierList != null && modifierList.hasModifierProperty(PsiModifier.STATIC) && modifierList.hasModifierProperty(PsiModifier.FINAL));
if (!isConstant) {
final TextWithImportsImpl textWithImports = new TextWithImportsImpl(reference);
try {
final ExpressionEvaluator evaluator = EvaluatorBuilderImpl.build(textWithImports, reference, myPosition);
evaluator.evaluate(myEvalContext);
//collect only expressions that do not produce any exceptions on evaluation
myExpressions.add(textWithImports);
}
catch (EvaluateException ignored) {
}
myExpressions.add(new TextWithImportsImpl(reference));
}
}
}
@@ -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.
@@ -79,12 +79,12 @@ public class NewProjectUtil {
try {
if (StorageScheme.DIRECTORY_BASED == dialog.getStorageScheme()) {
final File ideaDir = new File(projectFilePath + File.separator + ".idea");
final File ideaDir = new File(projectFilePath, Project.DIRECTORY_STORE_FOLDER);
if (!ideaDir.exists() && !ideaDir.mkdirs()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Messages.showErrorDialog("Unable to create '.idea' directory at: " + projectFilePath, "Project initialization failed");
Messages.showErrorDialog("Unable to create '.idea' directory at: " + projectFilePath, "Project Initialization Failed");
}
});
@@ -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.
@@ -24,6 +24,7 @@ import com.intellij.ide.util.projectWizard.importSources.impl.ProjectFromSources
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.projectImport.ProjectFormatPanel;
@@ -111,7 +112,7 @@ public class ProjectNameStep extends ModuleWizardStep {
return getProjectFileDirectory() + "/" + myNamePathComponent.getNameValue() + ProjectFileType.DOT_DEFAULT_EXTENSION;
}
else {
return getProjectFileDirectory() + "/" + ".idea";
return getProjectFileDirectory() + "/" + Project.DIRECTORY_STORE_FOLDER;
}
}
else {
@@ -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.
@@ -21,7 +21,7 @@ import com.intellij.ide.highlighter.ProjectFileType;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.ProjectCoreUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
@@ -118,18 +118,17 @@ public class ProjectNameStep extends ModuleWizardStep {
boolean shouldContinue = true;
final String path = myWizardContext.isCreatingNewProject() && myWizardContext.getProjectStorageFormat() == DIRECTORY_BASED
? getProjectFileDirectory() + "/" + ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR
: getProjectFilePath();
? getProjectFileDirectory() + "/" + Project.DIRECTORY_STORE_FOLDER : getProjectFilePath();
final File projectFile = new File(path);
if (projectFile.exists()) {
final String title = myWizardContext.isCreatingNewProject()
? IdeBundle.message("title.new.project")
: IdeBundle.message("title.add.module");
final String message = myWizardContext.isCreatingNewProject() && myWizardContext.getProjectStorageFormat() == DIRECTORY_BASED
? IdeBundle.message("prompt.overwrite.project.folder", ProjectCoreUtil.DIRECTORY_BASED_PROJECT_DIR,
projectFile.getParentFile().getAbsolutePath())
: IdeBundle.message("prompt.overwrite.project.file", projectFile.getAbsolutePath(),
myWizardContext.getPresentationName());
? IdeBundle.message("prompt.overwrite.project.folder",
Project.DIRECTORY_STORE_FOLDER, projectFile.getParentFile().getAbsolutePath())
: IdeBundle.message("prompt.overwrite.project.file",
projectFile.getAbsolutePath(), myWizardContext.getPresentationName());
int answer = Messages.showYesNoDialog(message, title, Messages.getQuestionIcon());
shouldContinue = answer == 0;
}
@@ -1,3 +1,18 @@
/*
* 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.checkout;
import com.intellij.ide.impl.ProjectUtil;
@@ -9,16 +24,15 @@ import java.io.File;
/**
* @author irengrig
* Date: 5/27/11
* Time: 12:57 PM
* @since 5/27/11
*/
public class ProjectDirCheckoutListener implements CheckoutListener {
@Override
public boolean processCheckedOutDirectory(Project project, File directory) {
if (new File(directory, ".idea").exists()) {
int rc = Messages
.showYesNoDialog(project, VcsBundle.message("checkout.open.project.dir.prompt", ProjectCheckoutListener.getProductNameWithArticle(),
directory.getPath()), VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
if (new File(directory, Project.DIRECTORY_STORE_FOLDER).exists()) {
String message = VcsBundle.message("checkout.open.project.dir.prompt",
ProjectCheckoutListener.getProductNameWithArticle(), directory.getPath());
int rc = Messages.showYesNoDialog(project, message, VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
if (rc == 0) {
ProjectUtil.openProject(directory.getPath(), project, false);
}
@@ -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.
@@ -151,7 +151,7 @@ public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder> e
}
wizardContext.setProjectJdk(jdk);
final String dotIdeaFilePath = wizardContext.getProjectFileDirectory() + File.separator + ".idea";
final String dotIdeaFilePath = wizardContext.getProjectFileDirectory() + File.separator + Project.DIRECTORY_STORE_FOLDER;
final String projectFilePath = wizardContext.getProjectFileDirectory() + File.separator + wizardContext.getProjectName() +
ProjectFileType.DOT_DEFAULT_EXTENSION;
@@ -43,7 +43,7 @@ public class ClassByNameMerger implements Consumer<LookupElement> {
if (lastElement != null) {
if (lastElement.getLookupString().equals(element.getLookupString())) {
number++;
lastElement = LookupElementBuilder.create(element.getLookupString()).setTailText(" (" + number + " variants...)", true);
lastElement = LookupElementBuilder.create(element.getLookupString()).withTailText(" (" + number + " variants...)", true);
return;
}
@@ -36,7 +36,8 @@ public class JavaLookupElementBuilder {
public static LookupElementBuilder forField(@NotNull PsiField field,
final String lookupString,
final @Nullable PsiClass qualifierClass) {
final LookupElementBuilder builder = LookupElementBuilder.create(field, lookupString).setIcon(field.getIcon(Iconable.ICON_FLAG_VISIBILITY));
final LookupElementBuilder builder = LookupElementBuilder.create(field, lookupString).withIcon(
field.getIcon(Iconable.ICON_FLAG_VISIBILITY));
return setBoldIfInClass(field, qualifierClass, builder);
}
@@ -48,14 +49,14 @@ public class JavaLookupElementBuilder {
@NotNull String lookupString, final @NotNull PsiSubstitutor substitutor,
@Nullable PsiClass qualifierClass) {
LookupElementBuilder builder = LookupElementBuilder.create(method, lookupString)
.setIcon(method.getIcon(Iconable.ICON_FLAG_VISIBILITY))
.setPresentableText(method.getName())
.setTailText(PsiFormatUtil.formatMethod(method, substitutor,
PsiFormatUtil.SHOW_PARAMETERS,
PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_TYPE));
.withIcon(method.getIcon(Iconable.ICON_FLAG_VISIBILITY))
.withPresentableText(method.getName())
.withTailText(PsiFormatUtil.formatMethod(method, substitutor,
PsiFormatUtil.SHOW_PARAMETERS,
PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_TYPE));
final PsiType returnType = method.getReturnType();
if (returnType != null) {
builder = builder.setTypeText(substitutor.substitute(returnType).getPresentableText());
builder = builder.withTypeText(substitutor.substitute(returnType).getPresentableText());
}
builder = setBoldIfInClass(method, qualifierClass, builder);
return builder;
@@ -63,7 +64,7 @@ public class JavaLookupElementBuilder {
private static LookupElementBuilder setBoldIfInClass(@NotNull PsiMember member, @Nullable PsiClass psiClass, @NotNull LookupElementBuilder builder) {
if (psiClass != null && member.getManager().areElementsEquivalent(member.getContainingClass(), psiClass)) {
return builder.setBold();
return builder.bold();
}
return builder;
}
@@ -81,9 +82,9 @@ public class JavaLookupElementBuilder {
final String lookupString,
final boolean withLocation) {
final LookupElementBuilder builder =
LookupElementBuilder.create(psiClass, lookupString).setIcon(psiClass.getIcon(Iconable.ICON_FLAG_VISIBILITY));
LookupElementBuilder.create(psiClass, lookupString).withIcon(psiClass.getIcon(Iconable.ICON_FLAG_VISIBILITY));
if (withLocation) {
return builder.setTailText(" (" + PsiFormatUtil.getPackageDisplayName(psiClass) + ")", true);
return builder.withTailText(" (" + PsiFormatUtil.getPackageDisplayName(psiClass) + ")", true);
}
return builder;
}
@@ -345,9 +345,9 @@ public class JavaMemberNameCompletionContributor extends CompletionContributor {
if (ourClassParent.isAnnotationType() && matcher.prefixMatches(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME)) {
set.add(LookupElementBuilder.create(PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME)
.setIcon(PlatformIcons.METHOD_ICON)
.setTailText("()")
.setInsertHandler(ParenthesesInsertHandler.NO_PARAMETERS));
.withIcon(PlatformIcons.METHOD_ICON)
.withTailText("()")
.withInsertHandler(ParenthesesInsertHandler.NO_PARAMETERS));
}
addLookupItems(set, null, matcher, element.getProject(), getUnresolvedReferences(ourClassParent, true));
@@ -86,7 +86,7 @@ class SameSignatureCallParametersProvider extends CompletionProvider<CompletionP
icon.setIcon(PlatformIcons.PARAMETER_ICON, 0, 2*w/5, 0);
icon.setIcon(PlatformIcons.PARAMETER_ICON, 1);
final LookupElement element = LookupElementBuilder.create(lookupString).setIcon(icon);
final LookupElement element = LookupElementBuilder.create(lookupString).withIcon(icon);
element.putUserData(JavaCompletionUtil.SUPER_METHOD_PARAMETERS, Boolean.TRUE);
return TailTypeDecorator.withTail(element, ExpectedTypesProvider.getFinalCallParameterTailType(call, invoked.getReturnType(), invoked));
@@ -139,14 +139,14 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix {
@Override
public LookupElement[] calculateLookupItems(ExpressionContext context) {
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
set.add(JavaLookupElementBuilder.forField(myField).setTypeText(myField.getType().getPresentableText()));
set.add(JavaLookupElementBuilder.forField(myField).withTypeText(myField.getType().getPresentableText()));
PsiField[] fields = myClass.getFields();
for (PsiField otherField : fields) {
if (!myDefaultFieldName.equals(otherField.getName())) {
PsiType otherType = otherField.getType();
for (PsiType type : myExpectedTypes) {
if (type.equals(otherType)) {
set.add(JavaLookupElementBuilder.forField(otherField).setTypeText(otherType.getPresentableText()));
set.add(JavaLookupElementBuilder.forField(otherField).withTypeText(otherType.getPresentableText()));
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.psi.impl.source.javadoc;
import com.intellij.codeInspection.SuppressionUtil;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.pom.java.LanguageLevel;
@@ -53,7 +54,7 @@ public class JavadocManagerImpl implements JavadocManager {
myInfos.add(new SimpleDocTagInfo("code", PsiElement.class, true, LanguageLevel.JDK_1_5));
//Not a standard tag, but added by IDEA for inspection suppression
myInfos.add(new SimpleDocTagInfo("noinspection", PsiElement.class, false, LanguageLevel.JDK_1_3));
myInfos.add(new SimpleDocTagInfo(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME, PsiElement.class, false, LanguageLevel.JDK_1_3));
myInfos.add(new ParamDocTagInfo());
myInfos.add(new ReturnDocTagInfo());
@@ -127,7 +127,7 @@ public class JavaLangClassMemberReference extends PsiReferenceBase<PsiLiteralExp
final List<LookupElementBuilder> elements = new ArrayList<LookupElementBuilder>();
for (PsiMethod method : psiClass.getMethods()) {
if (type == Type.DECLARED_METHOD || isPublic(method)) {
elements.add(JavaLookupElementBuilder.forMethod(method, PsiSubstitutor.EMPTY).setInsertHandler(this));
elements.add(JavaLookupElementBuilder.forMethod(method, PsiSubstitutor.EMPTY).withInsertHandler(this));
}
}
return elements.toArray();
@@ -563,7 +563,7 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer
return null;
}
}
return JavaLookupElementBuilder.forClass(clazz, name, true).addLookupString(qname).addLookupString(clazz.getName());
return JavaLookupElementBuilder.forClass(clazz, name, true).withLookupString(qname).withLookupString(clazz.getName());
}
@Override
@@ -347,7 +347,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
for (String completionVariant : info.names) {
final LookupElementBuilder element = LookupElementBuilder.create(completionVariant);
result.addElement(element.addLookupString(completionVariant.toLowerCase()));
result.addElement(element.withLookupString(completionVariant.toLowerCase()));
}
}
}