> getSourceRoots(@NotNull JpsModuleSourceRootType type);
+
@NotNull
& JpsElementTypeWithDefaultProperties
>
JpsModuleSourceRoot addSourceRoot(@NotNull String url, @NotNull Type rootType);
diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsModuleSourceRoot.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsModuleSourceRoot.java
index 8695702c8a64..ff3d5abda4a5 100644
--- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsModuleSourceRoot.java
+++ b/jps/model-api/src/org/jetbrains/jps/model/module/JpsModuleSourceRoot.java
@@ -16,6 +16,9 @@ public interface JpsModuleSourceRoot extends JpsElement {
@Nullable
P getProperties(@NotNull JpsModuleSourceRootType
type);
+ @Nullable
+
JpsTypedModuleSourceRoot
asTyped(@NotNull JpsModuleSourceRootType
type);
+
@NotNull
JpsElement getProperties();
diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsTypedModuleSourceRoot.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsTypedModuleSourceRoot.java
new file mode 100644
index 000000000000..f428bc5c642e
--- /dev/null
+++ b/jps/model-api/src/org/jetbrains/jps/model/module/JpsTypedModuleSourceRoot.java
@@ -0,0 +1,18 @@
+package org.jetbrains.jps.model.module;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jps.model.JpsElement;
+import org.jetbrains.jps.model.JpsTypedElement;
+
+/**
+ * @author nik
+ */
+public interface JpsTypedModuleSourceRoot
extends JpsModuleSourceRoot, JpsTypedElement
{
+ @NotNull
+ @Override
+ P getProperties();
+
+ @NotNull
+ @Override
+ JpsModuleSourceRootType
getRootType();
+}
diff --git a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JpsJavaExtensionServiceImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JpsJavaExtensionServiceImpl.java
index 323a0b1e34fc..52f144b29d56 100644
--- a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JpsJavaExtensionServiceImpl.java
+++ b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JpsJavaExtensionServiceImpl.java
@@ -7,7 +7,6 @@ import org.jetbrains.jps.JpsPathUtil;
import org.jetbrains.jps.model.JpsDummyElement;
import org.jetbrains.jps.model.JpsGlobal;
import org.jetbrains.jps.model.JpsProject;
-import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.java.*;
import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerConfiguration;
import org.jetbrains.jps.model.java.impl.compiler.JpsJavaCompilerConfigurationImpl;
@@ -118,22 +117,6 @@ public class JpsJavaExtensionServiceImpl extends JpsJavaExtensionService {
return url != null ? JpsPathUtil.urlToFile(url) : null;
}
- @Override
- public String getSourcePrefix(JpsModule module, String rootUrl) {
- for (JpsModuleSourceRoot root : module.getSourceRoots()) {
- if (root.getUrl().equals(rootUrl)) {
- JpsModuleSourceRootType> type = root.getRootType();
- if (type instanceof JavaSourceRootType) {
- final JpsSimpleElement properties = root.getProperties((JavaSourceRootType)type);
- if (properties != null) {
- return properties.getData().getPackagePrefix();
- }
- }
- }
- }
- return null;
- }
-
@Override
public JpsTypedLibrary> addJavaSdk(@NotNull JpsGlobal global, @NotNull String name, @NotNull String homePath) {
String version = JdkVersionDetector.getInstance().detectJdkVersion(homePath);
diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java
index 76d2aedf5bbd..1346467b912c 100644
--- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java
+++ b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java
@@ -90,6 +90,12 @@ public class JpsModuleImpl extends JpsNamedCompositeElemen
return myContainer.getChild(JpsModuleSourceRootRole.ROOT_COLLECTION_ROLE).getElements();
}
+ @NotNull
+ @Override
+ public
Iterable> getSourceRoots(@NotNull JpsModuleSourceRootType type) {
+ return myContainer.getChild(JpsModuleSourceRootRole.ROOT_COLLECTION_ROLE).getElementsOfType(type);
+ }
+
@NotNull
@Override
public
& JpsElementTypeWithDefaultProperties
>
diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleSourceRootImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleSourceRootImpl.java
index 4f4a5c018133..331bb24d3c97 100644
--- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleSourceRootImpl.java
+++ b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleSourceRootImpl.java
@@ -1,18 +1,20 @@
package org.jetbrains.jps.model.module.impl;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.JpsPathUtil;
import org.jetbrains.jps.model.JpsElement;
+import org.jetbrains.jps.model.JpsElementType;
import org.jetbrains.jps.model.impl.JpsCompositeElementBase;
-import org.jetbrains.jps.model.module.JpsModuleSourceRoot;
import org.jetbrains.jps.model.module.JpsModuleSourceRootType;
+import org.jetbrains.jps.model.module.JpsTypedModuleSourceRoot;
import java.io.File;
/**
* @author nik
*/
-public class JpsModuleSourceRootImpl
extends JpsCompositeElementBase> implements JpsModuleSourceRoot {
+public class JpsModuleSourceRootImpl extends JpsCompositeElementBase> implements JpsTypedModuleSourceRoot {
private final JpsModuleSourceRootType
myRootType;
private final String myUrl;
@@ -38,6 +40,18 @@ public class JpsModuleSourceRootImpl
extends JpsCompositeE
return null;
}
+ @Nullable
+ @Override
+ public
JpsTypedModuleSourceRoot
asTyped(@NotNull JpsModuleSourceRootType
type) {
+ //noinspection unchecked
+ return myRootType.equals(type) ? (JpsTypedModuleSourceRoot
)this : null;
+ }
+
+ @Override
+ public JpsElementType> getType() {
+ return myRootType;
+ }
+
@NotNull
@Override
public P getProperties() {
@@ -46,7 +60,7 @@ public class JpsModuleSourceRootImpl
extends JpsCompositeE
@NotNull
@Override
- public JpsModuleSourceRootType> getRootType() {
+ public JpsModuleSourceRootType
getRootType() {
return myRootType;
}
diff --git a/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsModuleTest.java b/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsModuleTest.java
index 8a1f7ef6f99f..7ea19d044e09 100644
--- a/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsModuleTest.java
+++ b/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsModuleTest.java
@@ -1,6 +1,7 @@
package org.jetbrains.jps.model;
import com.intellij.util.containers.ContainerUtil;
+import com.intellij.util.containers.ContainerUtilRt;
import org.jetbrains.jps.model.java.*;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.library.sdk.JpsSdk;
@@ -23,9 +24,11 @@ public class JpsModuleTest extends JpsModelTestCase {
final JpsModuleSourceRoot root = assertOneElement(module.getSourceRoots());
assertEquals("file://url", root.getUrl());
- final JpsSimpleElement properties2 = root.getProperties(JavaSourceRootType.SOURCE);
- assertNotNull(properties2);
- assertEquals("com.xxx", properties2.getData().getPackagePrefix());
+ assertSameElements(ContainerUtilRt.newArrayList(module.getSourceRoots(JavaSourceRootType.SOURCE)), root);
+ assertEmpty(ContainerUtil.newArrayList(module.getSourceRoots(JavaSourceRootType.TEST_SOURCE)));
+ JpsTypedModuleSourceRoot> typedRoot = root.asTyped(JavaSourceRootType.SOURCE);
+ assertNotNull(typedRoot);
+ assertEquals("com.xxx", typedRoot.getProperties().getData().getPackagePrefix());
}
public void testGetModulesOfType() {
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java
index 65b87eb8a1da..9ca465e44cf0 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionLookupArranger.java
@@ -95,7 +95,12 @@ public class CompletionLookupArranger extends LookupArranger {
}
private MultiMap groupItemsBySorter(List source) {
- MultiMap inputBySorter = new MultiMap();
+ MultiMap inputBySorter = new MultiMap() {
+ @Override
+ protected Map> createMap() {
+ return ContainerUtil.newLinkedHashMap();
+ }
+ };
for (LookupElement element : source) {
inputBySorter.putValue(obtainSorter(element), element);
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCharFilter.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCharFilter.java
index 20c02c3a66c1..966912e3d330 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCharFilter.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCharFilter.java
@@ -34,6 +34,10 @@ public class LiveTemplateCharFilter extends CharFilter {
}
return Result.HIDE_LOOKUP;
}
+ if (item instanceof TemplateExpressionLookupElement) {
+ if (Character.isJavaIdentifierPart(c)) return Result.ADD_TO_PREFIX;
+ return Result.HIDE_LOOKUP;
+ }
return null;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java
index 29eff09ae690..5aa90f415713 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateSettingsEditor.java
@@ -98,17 +98,21 @@ public class LiveTemplateSettingsEditor extends JPanel {
myTemplate.setId(null);
createComponents(allowNoContext);
-
- com.intellij.ui.DocumentAdapter listener = new com.intellij.ui.DocumentAdapter() {
+
+ myKeyField.getDocument().addDocumentListener(new com.intellij.ui.DocumentAdapter() {
@Override
protected void textChanged(javax.swing.event.DocumentEvent e) {
myTemplate.setKey(myKeyField.getText().trim());
+ nodeChanged.run();
+ }
+ });
+ myDescription.getDocument().addDocumentListener(new com.intellij.ui.DocumentAdapter() {
+ @Override
+ protected void textChanged(javax.swing.event.DocumentEvent e) {
myTemplate.setDescription(myDescription.getText().trim());
nodeChanged.run();
}
- };
- myKeyField.getDocument().addDocumentListener(listener);
- myDescription.getDocument().addDocumentListener(listener);
+ });
new UiNotifyConnector(this, new Activatable.Adapter() {
@Override
@@ -474,7 +478,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
myEditVariablesButton.setEnabled(!parseVariables(myTemplateEditor.getDocument().getCharsSequence()).isEmpty());
}
- private void reset() {
+ void resetUi() {
myKeyField.setText(myTemplate.getKey());
myDescription.setText(myTemplate.getDescription());
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java
new file mode 100644
index 000000000000..c82c2af7e1a0
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateExpressionLookupElement.java
@@ -0,0 +1,97 @@
+/*
+ * 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.codeInsight.template.impl;
+
+import com.intellij.codeInsight.AutoPopupController;
+import com.intellij.codeInsight.completion.CompletionInitializationContext;
+import com.intellij.codeInsight.completion.InsertionContext;
+import com.intellij.codeInsight.completion.OffsetMap;
+import com.intellij.codeInsight.completion.PrioritizedLookupElement;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.lookup.LookupElementDecorator;
+import com.intellij.codeInsight.lookup.LookupItem;
+import com.intellij.codeInsight.template.TemplateLookupSelectionHandler;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.EditorModificationUtil;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.PsiDocumentManager;
+import com.intellij.psi.PsiFile;
+
+import java.util.List;
+
+/**
+* @author peter
+*/
+class TemplateExpressionLookupElement extends LookupElementDecorator {
+ private TemplateState myState;
+
+ public TemplateExpressionLookupElement(final TemplateState state, LookupElement element, int index) {
+ super(PrioritizedLookupElement.withPriority(element, Integer.MAX_VALUE - 10 - index));
+ myState = state;
+ }
+
+ private static InsertionContext createInsertionContext(LookupElement item,
+ PsiFile psiFile,
+ List extends LookupElement> elements,
+ Editor editor) {
+ final OffsetMap offsetMap = new OffsetMap(editor.getDocument());
+ final InsertionContext context = new InsertionContext(offsetMap, (char)0, elements.toArray(new LookupElement[elements.size()]), psiFile, editor, false);
+ context.setTailOffset(editor.getCaretModel().getOffset());
+ offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, context.getTailOffset() - item.getLookupString().length());
+ offsetMap.addOffset(CompletionInitializationContext.SELECTION_END_OFFSET, context.getTailOffset());
+ offsetMap.addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, context.getTailOffset());
+ return context;
+ }
+
+ void handleTemplateInsert(List extends LookupElement> elements) {
+ InsertionContext context = createInsertionContext(this, myState.getPsiFile(), elements, myState.getEditor());
+ handleInsert(context);
+ Disposer.dispose(context.getOffsetMap());
+ }
+
+ @Override
+ public void handleInsert(InsertionContext context) {
+ LookupElement item = getDelegate();
+ Project project = context.getProject();
+ Editor editor = context.getEditor();
+
+ PsiDocumentManager.getInstance(project).commitAllDocuments();
+
+ TextRange range = myState.getCurrentVariableRange();
+ final TemplateLookupSelectionHandler handler =
+ item instanceof LookupItem ? ((LookupItem>)item).getAttribute(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM) : null;
+ if (handler != null && range != null) {
+ handler.itemSelected(item, context.getFile(), context.getDocument(), range.getStartOffset(), range.getEndOffset());
+ }
+ else {
+ super.handleInsert(context);
+ }
+
+ if (context.getCompletionChar() == '.') {
+ EditorModificationUtil.insertStringAtCaret(editor, ".");
+ AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null);
+ return;
+ }
+
+ if (!myState.isFinished()) {
+ myState.calcResults(true);
+ }
+
+ myState.nextTab();
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
index 5c7b97cfde76..0607ef24cf1a 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateListPanel.java
@@ -892,6 +892,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
createTemplateEditor(newTemplate, (String)myExpandByCombo.getSelectedItem(), getTemplateOptions(newTemplate),
getTemplateContext(newTemplate));
+ myCurrentTemplateEditor.resetUi();
if (focusKey) {
myCurrentTemplateEditor.focusKey();
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
index 2ee637c7a880..968a10b8057a 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java
@@ -16,12 +16,11 @@
package com.intellij.codeInsight.template.impl;
-import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.CodeInsightSettings;
-import com.intellij.codeInsight.completion.CompletionInitializationContext;
-import com.intellij.codeInsight.completion.InsertionContext;
-import com.intellij.codeInsight.completion.OffsetMap;
-import com.intellij.codeInsight.lookup.*;
+import com.intellij.codeInsight.lookup.LookupAdapter;
+import com.intellij.codeInsight.lookup.LookupElement;
+import com.intellij.codeInsight.lookup.LookupEvent;
+import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.lookup.impl.LookupImpl;
import com.intellij.codeInsight.template.*;
import com.intellij.lang.LanguageLiteralEscapers;
@@ -31,7 +30,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandAdapter;
import com.intellij.openapi.command.CommandEvent;
import com.intellij.openapi.command.CommandProcessor;
-import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.command.undo.BasicUndoableAction;
import com.intellij.openapi.command.undo.DocumentReference;
import com.intellij.openapi.command.undo.DocumentReferenceManager;
@@ -44,7 +42,6 @@ import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.markup.*;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -57,6 +54,7 @@ import com.intellij.psi.util.PsiUtilBase;
import com.intellij.refactoring.rename.inplace.InplaceRefactoring;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.PairProcessor;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import com.intellij.util.containers.IntArrayList;
import org.jetbrains.annotations.NonNls;
@@ -313,7 +311,7 @@ public class TemplateState implements Disposable {
myTemplateRange = myDocument.createRangeMarker(caretOffset, caretOffset + template.getTemplateText().length());
}
else {
- PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
+ PsiFile file = getPsiFile();
preprocessTemplate(file, myEditor.getCaretModel().getOffset(), myTemplate.getTemplateText());
int caretOffset = myEditor.getCaretModel().getOffset();
myTemplateRange = myDocument.createRangeMarker(caretOffset, caretOffset);
@@ -402,7 +400,7 @@ public class TemplateState implements Disposable {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
- final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
+ final PsiFile file = getPsiFile();
if (file != null) {
IntArrayList indices = initEmptyVariables();
mySegments.setSegmentsGreedy(false);
@@ -486,26 +484,23 @@ public class TemplateState implements Disposable {
myEditor.getSelectionModel().setSelection(start, end);
}
- Expression expressionNode = myTemplate.getExpressionAt(myCurrentVariableNumber);
- final ExpressionContext context = createExpressionContext(start);
- final LookupElement[] lookupItems = expressionNode.calculateLookupItems(context);
- final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
- if (lookupItems != null && lookupItems.length > 0) {
+ Expression expressionNode = getCurrentExpression();
+ final List lookupItems = getCurrentExpressionLookupItems();
+ final PsiFile psiFile = getPsiFile();
+ if (!lookupItems.isEmpty()) {
if (((TemplateManagerImpl)TemplateManager.getInstance(myProject)).shouldSkipInTests()) {
- final String s = lookupItems[0].getLookupString();
- EditorModificationUtil.insertStringAtCaret(myEditor, s);
- itemSelected(lookupItems[0], psiFile, currentSegmentNumber, ' ', lookupItems);
+ insertSingleItem(lookupItems);
}
else {
for (LookupElement lookupItem : lookupItems) {
assert lookupItem != null : expressionNode;
}
- runLookup(currentSegmentNumber, lookupItems, expressionNode.getAdvertisingText(), psiFile);
+ runLookup(lookupItems, expressionNode.getAdvertisingText());
}
}
else {
- Result result = expressionNode.calculateResult(context);
+ Result result = expressionNode.calculateResult(getCurrentExpressionContext());
if (result != null) {
result.handleFocused(psiFile, myDocument, mySegments.getSegmentStart(currentSegmentNumber),
mySegments.getSegmentEnd(currentSegmentNumber));
@@ -514,12 +509,42 @@ public class TemplateState implements Disposable {
focusCurrentHighlighter(true);
}
- private void runLookup(final int currentSegmentNumber, final LookupElement[] lookupItems, String advertisingText, final PsiFile psiFile) {
+ PsiFile getPsiFile() {
+ return PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
+ }
+
+ private void insertSingleItem(List lookupItems) {
+ TemplateExpressionLookupElement first = lookupItems.get(0);
+ EditorModificationUtil.insertStringAtCaret(myEditor, first.getLookupString());
+ first.handleTemplateInsert(lookupItems);
+ }
+
+ @NotNull
+ List getCurrentExpressionLookupItems() {
+ LookupElement[] elements = getCurrentExpression().calculateLookupItems(getCurrentExpressionContext());
+ if (elements == null) return Collections.emptyList();
+
+ List result = ContainerUtil.newArrayList();
+ for (int i = 0; i < elements.length; i++) {
+ result.add(new TemplateExpressionLookupElement(this, elements[i], i));
+ }
+ return result;
+ }
+
+ ExpressionContext getCurrentExpressionContext() {
+ return createExpressionContext(mySegments.getSegmentStart(getCurrentSegmentNumber()));
+ }
+
+ Expression getCurrentExpression() {
+ return myTemplate.getExpressionAt(myCurrentVariableNumber);
+ }
+
+ private void runLookup(final List lookupItems, String advertisingText) {
if (myEditor == null) return;
final LookupManager lookupManager = LookupManager.getInstance(myProject);
- final LookupImpl lookup = (LookupImpl)lookupManager.showLookup(myEditor, lookupItems);
+ final LookupImpl lookup = (LookupImpl)lookupManager.showLookup(myEditor, lookupItems.toArray(new LookupElement[lookupItems.size()]));
if (lookup == null) return;
if (CodeInsightSettings.getInstance().AUTO_POPUP_COMPLETION_LOOKUP && myEditor.getUserData(InplaceRefactoring.INPLACE_RENAMER) == null) {
@@ -542,68 +567,21 @@ public class TemplateState implements Disposable {
if (isFinished()) return;
ourLookupShown = false;
- TemplateState.this.itemSelected(event.getItem(), psiFile, currentSegmentNumber, event.getCompletionChar(), lookupItems);
+ LookupElement item = event.getItem();
+ if (item instanceof TemplateExpressionLookupElement) {
+ ((TemplateExpressionLookupElement)item).handleTemplateInsert(lookupItems);
+ }
}
});
}
- private void itemSelected(final LookupElement item,
- final PsiFile psiFile,
- final int currentSegmentNumber,
- final char completionChar,
- LookupElement[] elements) {
- if (item != null) {
- PsiDocumentManager.getInstance(myProject).commitAllDocuments();
-
- final OffsetMap offsetMap = new OffsetMap(myDocument);
- final InsertionContext context = new InsertionContext(offsetMap, (char)0, elements, psiFile, myEditor, false);
- context.setTailOffset(myEditor.getCaretModel().getOffset());
- offsetMap.addOffset(CompletionInitializationContext.START_OFFSET, context.getTailOffset() - item.getLookupString().length());
- offsetMap.addOffset(CompletionInitializationContext.SELECTION_END_OFFSET, context.getTailOffset());
- offsetMap.addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, context.getTailOffset());
-
- final TemplateLookupSelectionHandler handler =
- item instanceof LookupItem ? ((LookupItem>)item).getAttribute(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM) : null;
- if (handler != null) {
- handler.itemSelected(item, psiFile, myDocument, mySegments.getSegmentStart(currentSegmentNumber),
- mySegments.getSegmentEnd(currentSegmentNumber));
- }
- else {
- new WriteCommandAction(myProject) {
- @Override
- protected void run(com.intellij.openapi.application.Result result) throws Throwable {
- item.handleInsert(context);
- }
- }.execute();
- }
- Disposer.dispose(offsetMap);
-
- if (completionChar == '.') {
- EditorModificationUtil.insertStringAtCaret(myEditor, ".");
- AutoPopupController.getInstance(myProject).autoPopupMemberLookup(myEditor, null);
- return;
- }
-
- if (!isFinished()) {
- calcResults(true);
- }
- }
-
- new WriteCommandAction(myProject) {
- @Override
- protected void run(com.intellij.openapi.application.Result result) throws Throwable {
- nextTab();
- }
- }.execute();
- }
-
private void unblockDocument() {
PsiDocumentManager.getInstance(myProject).commitDocument(myDocument);
PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(myDocument);
}
// Hours spent fixing code : 1
- private void calcResults(final boolean isQuick) {
+ void calcResults(final boolean isQuick) {
if (myProcessor != null && myCurrentVariableNumber >= 0) {
final String variableName = myTemplate.getVariableNameAt(myCurrentVariableNumber);
final TextResult value = getVariableValue(variableName);
@@ -672,7 +650,7 @@ public class TemplateState implements Disposable {
int end = mySegments.getSegmentEnd(segmentNumber);
PsiDocumentManager.getInstance(myProject).commitDocument(myDocument);
- PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
+ PsiFile psiFile = getPsiFile();
PsiElement element = psiFile.findElementAt(start);
ExpressionContext context = createExpressionContext(start);
@@ -1012,7 +990,7 @@ public class TemplateState implements Disposable {
}
private void reformat(RangeMarker rangeMarkerToReformat) {
- final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(myDocument);
+ final PsiFile file = getPsiFile();
if (file != null) {
CodeStyleManager style = CodeStyleManager.getInstance(myProject);
for (TemplateOptionalProcessor optionalProcessor : Extensions.getExtensions(TemplateOptionalProcessor.EP_NAME)) {
diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
index bdb13ea1b78e..df913f1e6dc7 100644
--- a/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.java
@@ -282,7 +282,14 @@ public class ExecutionManagerImpl extends ExecutionManager implements ProjectCom
return CommonBundle.message("dialog.options.do.not.show");
}
};
- if (Messages.OK != Messages.showOkCancelDialog(ExecutionBundle.message("rerun.confirmation.message", configuration.getName()),
+ String message;
+ if (allHandlers.size() == 1 && handler != null) {//we restart single running configuration
+ message = ExecutionBundle.message("rerun.confirmation.message", configuration.getName());
+ }
+ else {
+ message = ExecutionBundle.message("rerun.singleton.confirmation.message", configuration.getName());
+ }
+ if (Messages.OK != Messages.showOkCancelDialog(message,
ExecutionBundle.message("rerun.confirmation.title") +
" (" +
pair.getSecond().getId() +
diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectTemplate.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectTemplate.java
index 5ed5c2f7830f..cb8b3c7a489d 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectTemplate.java
+++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/WebProjectTemplate.java
@@ -43,16 +43,12 @@ public abstract class WebProjectTemplate extends WebProjectGenerator imple
}
};
- @Override
- public void generateProject(Module module) {
- generateProject(module.getProject(), module.getProject().getBaseDir(), myPeer.getValue().getSettings(), module);
- }
-
@Override
public JComponent getSettingsPanel() {
return myPeer.getValue().getComponent();
}
+ @NotNull
@Override
public ProjectBuilder createModuleBuilder() {
final ModuleBuilder builder = WebModuleType.getInstance().createModuleBuilder();
@@ -62,7 +58,8 @@ public abstract class WebProjectTemplate extends WebProjectGenerator imple
public List commit(Project project, ModifiableModuleModel model, ModulesProvider modulesProvider) {
List modules = builder.commit(project, model, modulesProvider);
if (modules != null && !modules.isEmpty()) {
- generateProject(modules.get(0));
+ Module module = modules.get(0);
+ generateProject(module.getProject(), module.getProject().getBaseDir(), myPeer.getValue().getSettings(), module);
}
return modules;
}
diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java
index 506d9de50c47..0ce108c3906b 100644
--- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java
+++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/SdkConfigurationUtil.java
@@ -17,7 +17,6 @@
package com.intellij.openapi.projectRoots.impl;
import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.PathChooserDialog;
@@ -33,11 +32,6 @@ import com.intellij.openapi.projectRoots.SdkType;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.ui.popup.JBPopupFactory;
-import com.intellij.openapi.ui.popup.ListPopup;
-import com.intellij.openapi.ui.popup.ListPopupStep;
-import com.intellij.openapi.ui.popup.PopupStep;
-import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
@@ -48,7 +42,6 @@ import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import javax.swing.*;
import java.util.*;
/**
@@ -166,7 +159,7 @@ public class SdkConfigurationUtil {
e.getMessage() +
".\nPlease make sure that " +
FileUtil.toSystemDependentName(homeDir.getPath()) +
- " is a valid home path for this SDK type.", "Error configuring SDK");
+ " is a valid home path for this SDK type.", "Error Configuring SDK");
}
return null;
}
@@ -298,65 +291,6 @@ public class SdkConfigurationUtil {
return LocalFileSystem.getInstance().findFileByPath(homepath);
}
- public static void suggestAndAddSdk(@Nullable final Project project,
- final Sdk[] existingSdks,
- JComponent popupOwner,
- final Consumer callback,
- final SdkType... sdkTypes) {
- assert sdkTypes.length > 0;
- final Map suggestedSdkHomes = new LinkedHashMap();
- for (SdkType sdkType : sdkTypes) {
- final Collection sdkHomes = sdkType.suggestHomePaths();
- for (String sdkHome : filterExistingPaths(sdkType, sdkHomes, existingSdks)) {
- suggestedSdkHomes.put(sdkHome, sdkType);
- }
- }
- if (suggestedSdkHomes.size() > 0) {
- suggestedSdkHomes.put(null, sdkTypes[0]);
- showSuggestedHomesPopup(project, existingSdks, suggestedSdkHomes, sdkTypes, popupOwner, callback);
- }
- else {
- createSdk(project, existingSdks, callback, sdkTypes);
- }
- }
-
- private static void showSuggestedHomesPopup(@Nullable final Project project,
- final Sdk[] existingSdks,
- final Map suggestedSdkHomes,
- final SdkType[] sdkTypes,
- final JComponent popupOwner,
- final Consumer callback) {
- final List list = new ArrayList(suggestedSdkHomes.keySet());
- ListPopupStep sdkHomesStep = new BaseListPopupStep("Select Interpreter Path", list) {
- @NotNull
- @Override
- public String getTextFor(String value) {
- return value == null ? "Specify Other..." : FileUtil.toSystemDependentName(value);
- }
-
- @Override
- public PopupStep onChosen(final String selectedValue, boolean finalChoice) {
- final SdkType sdkType = suggestedSdkHomes.get(selectedValue);
- if (selectedValue == null) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- @Override
- public void run() {
- createSdk(project, existingSdks, callback, sdkTypes);
- }
- }, ModalityState.current());
- }
- else {
- Sdk sdk = setupSdk(existingSdks, LocalFileSystem.getInstance().findFileByPath(selectedValue),
- sdkType, false, null, null);
- callback.consume(sdk);
- }
- return FINAL_CHOICE;
- }
- };
- final ListPopup popup = JBPopupFactory.getInstance().createListPopup(sdkHomesStep);
- popup.showUnderneathOf(popupOwner);
- }
-
public static List filterExistingPaths(SdkType sdkType, Collection sdkHomes, final Sdk[] sdks) {
List result = new ArrayList();
for (String sdkHome : sdkHomes) {
diff --git a/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java b/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
index 1c55471fa033..1163b5e073da 100644
--- a/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
+++ b/platform/lang-impl/src/com/intellij/platform/templates/github/ZipUtil.java
@@ -11,18 +11,18 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Enumeration;
import java.util.concurrent.Callable;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
/**
* @author Sergey Simonchik
*/
-class ZipUtil {
+public class ZipUtil {
private static final Logger LOG = Logger.getInstance(ZipUtil.class);
@@ -38,7 +38,8 @@ class ZipUtil {
@Override
public Boolean call() throws IOException {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
- unzip(progress, zipArchive, extractToDir);
+ ZipInputStream stream = new ZipInputStream(new FileInputStream(zipArchive));
+ unzip(progress, extractToDir, stream);
return true;
}
},
@@ -60,21 +61,17 @@ class ZipUtil {
}
}
- private static void unzip(@Nullable ProgressIndicator progress,
- @NotNull File zipArchiveFile,
- @NotNull File extractToDir) throws IOException {
+ public static void unzip(@Nullable ProgressIndicator progress, File extractToDir, ZipInputStream stream) throws IOException {
if (progress != null) {
progress.setText("Extracting...");
}
- ZipFile zipFile = new ZipFile(zipArchiveFile);
try {
- boolean singleTopLevelDir = isSingleTopLevelDir(zipFile.entries());
- for (Enumeration extends ZipEntry> e = zipFile.entries(); e.hasMoreElements();) {
- ZipEntry zipEntry = e.nextElement();
- unzipEntryToDir(progress, zipFile, zipEntry, extractToDir, singleTopLevelDir);
+ ZipEntry entry;
+ while ((entry = stream.getNextEntry()) != null) {
+ unzipEntryToDir(progress, entry, extractToDir, stream);
}
} finally {
- zipFile.close();
+ stream.close();
}
}
@@ -99,12 +96,11 @@ class ZipUtil {
}
private static void unzipEntryToDir(@Nullable ProgressIndicator progress,
- @NotNull final ZipFile zipFile,
@NotNull final ZipEntry zipEntry,
@NotNull final File extractToDir,
- boolean singleTopLevelDir) throws IOException {
+ ZipInputStream stream) throws IOException {
final char pathDelimiterChar = '/';
- String relativeExtractPath = createRelativeExtractPath(zipEntry, pathDelimiterChar, singleTopLevelDir);
+ String relativeExtractPath = createRelativeExtractPath(zipEntry, pathDelimiterChar, true);
int ind = relativeExtractPath.lastIndexOf(pathDelimiterChar);
final String relativeParentDir;
final String name;
@@ -129,13 +125,11 @@ class ZipUtil {
}
}
File child = new File(parentDir, name);
- InputStream stream = zipFile.getInputStream(zipEntry);
FileOutputStream fileOutputStream = new FileOutputStream(child);
try {
FileUtil.copy(stream, fileOutputStream);
} finally {
fileOutputStream.close();
- stream.close();
}
LOG.info("Extract: " + relativeExtractPath);
}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactory.java b/platform/platform-api/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactory.java
index 0d69d5d84ca5..597b20a86a5b 100644
--- a/platform/platform-api/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactory.java
+++ b/platform/platform-api/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactory.java
@@ -16,12 +16,13 @@
package com.intellij.openapi.editor.highlighter;
import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.fileTypes.SyntaxHighlighter;
-import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* @author yole
@@ -38,11 +39,11 @@ public abstract class EditorHighlighterFactory {
public abstract EditorHighlighter createEditorHighlighter(final Project project, final FileType fileType);
- public abstract EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile file, final EditorColorsScheme globalScheme, final Project project);
+ public abstract EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile file, final EditorColorsScheme globalScheme, @Nullable final Project project);
public abstract EditorHighlighter createEditorHighlighter(final Project project, final VirtualFile file);
public abstract EditorHighlighter createEditorHighlighter(final Project project, final String fileName);
- public abstract EditorHighlighter createEditorHighlighter(final EditorColorsScheme settings, final String fileName, final Project project);
+ public abstract EditorHighlighter createEditorHighlighter(final EditorColorsScheme settings, final String fileName, @Nullable final Project project);
}
\ No newline at end of file
diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java b/platform/platform-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java
index cdc95b9e81ea..3796f59c0fb0 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java
+++ b/platform/platform-api/src/com/intellij/openapi/fileTypes/SyntaxHighlighterFactory.java
@@ -36,10 +36,26 @@ public abstract class SyntaxHighlighterFactory {
}
};
- public static SyntaxHighlighter getSyntaxHighlighter(Language lang, Project project, VirtualFile virtualFile) {
+ /**
+ * Returns syntax highlighter for the given language.
+ * @param lang a {@code Language} to get highlighter for
+ * @param project might be necessary to gather various project settings from
+ * @param virtualFile might be necessary to collect file specific settings
+ * @return {@code SyntaxHighlighter} interface implementation for the given file type
+ */
+ public static SyntaxHighlighter getSyntaxHighlighter(@NotNull Language lang, @Nullable Project project, @Nullable final VirtualFile virtualFile) {
return LANGUAGE_FACTORY.forLanguage(lang).getSyntaxHighlighter(project, virtualFile);
}
+ /**
+ * Returns syntax highlighter for the given file type.
+ * Note: it is recommended to use {@link #getSyntaxHighlighter(Language, Project, VirtualFile)} in most cases,
+ * and use this method only when you are do not know the language you use.
+ * @param fileType a file type to use to select appropriate highlighter
+ * @param project might be necessary to gather various project settings from
+ * @param virtualFile might be necessary to collect file specific settings
+ * @return {@code SyntaxHighlighter} interface implementation for the given file type
+ */
@Nullable
public static SyntaxHighlighter getSyntaxHighlighter(final FileType fileType, final @Nullable Project project, final @Nullable VirtualFile virtualFile) {
return PROVIDER.getValue().create(fileType, project, virtualFile);
@@ -57,5 +73,5 @@ public abstract class SyntaxHighlighterFactory {
* @return SyntaxHighlighter interface implementation for this particular language.
*/
@NotNull
- public abstract SyntaxHighlighter getSyntaxHighlighter(Project project, final VirtualFile virtualFile);
+ public abstract SyntaxHighlighter getSyntaxHighlighter(@Nullable Project project, @Nullable VirtualFile virtualFile);
}
\ No newline at end of file
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java b/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java
index 5523416bb782..5c0472c9b58c 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/NamedItemsListEditor.java
@@ -49,6 +49,7 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent {
private final Equality myComparer;
private List myResultItems;
private final List myOriginalItems;
+ private boolean myShowIcons;
protected NamedItemsListEditor(Namer namer,
Factory factory,
@@ -160,6 +161,10 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent {
myNamer.setName(item, name);
}
+ public void setShowIcons(boolean showIcons) {
+ myShowIcons = showIcons;
+ }
+
@Nullable
protected UnnamedConfigurable getItemConfigurable(final T item) {
final Ref result = new Ref();
@@ -213,6 +218,14 @@ public abstract class NamedItemsListEditor extends MasterDetailsComponent {
return myNamer.getName(myItem);
}
+ @Override
+ public Icon getIcon(boolean expanded) {
+ if (myShowIcons && myConfigurable instanceof Iconable) {
+ return ((Iconable)myConfigurable).getIcon(0);
+ }
+ return null;
+ }
+
public String getHelpTopic() {
return null;
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
index 40e50923ce4a..a01f0fa3d6a1 100644
--- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
@@ -100,6 +100,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
public void customize(DiffToolbar toolbar) {
ActionManager actionManager = ActionManager.getInstance();
toolbar.addAction(actionManager.getAction("DiffPanel.Toolbar"));
+ toolbar.addAction(actionManager.getAction("ContextHelp"));
}
};
private boolean myDisposed = false;
@@ -830,6 +831,9 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
return new DiffNavigatable(currentSide);
}
}
+ if (PlatformDataKeys.HELP_ID.is(dataId)) {
+ return "reference.dialogs.diff.file";
+ }
return super.getData(dataId);
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java
index 27de1506dcc8..daee8d0e0e23 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/highlighter/EditorHighlighterFactoryImpl.java
@@ -57,7 +57,7 @@ public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
}
@Override
- public EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile vFile, @NotNull final EditorColorsScheme settings, final Project project) {
+ public EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile vFile, @NotNull final EditorColorsScheme settings, @Nullable final Project project) {
final FileType fileType = vFile.getFileType();
if (fileType instanceof LanguageFileType) {
LanguageFileType substFileType = substituteFileType(((LanguageFileType)fileType).getLanguage(), vFile, project);
@@ -120,7 +120,7 @@ public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
}
@Override
- public EditorHighlighter createEditorHighlighter(final EditorColorsScheme settings, final String fileName, final Project project) {
+ public EditorHighlighter createEditorHighlighter(final EditorColorsScheme settings, final String fileName, @Nullable final Project project) {
return createEditorHighlighter(new LightVirtualFile(fileName), settings, project);
}
}
\ No newline at end of file
diff --git a/platform/platform-impl/src/com/intellij/platform/ProjectTemplate.java b/platform/platform-impl/src/com/intellij/platform/ProjectTemplate.java
index 8e25b4cfffea..1fabea513f6e 100644
--- a/platform/platform-impl/src/com/intellij/platform/ProjectTemplate.java
+++ b/platform/platform-impl/src/com/intellij/platform/ProjectTemplate.java
@@ -16,7 +16,8 @@
package com.intellij.platform;
import com.intellij.ide.util.projectWizard.ProjectBuilder;
-import com.intellij.openapi.module.Module;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -30,9 +31,9 @@ public interface ProjectTemplate {
String getDescription();
- ProjectBuilder createModuleBuilder();
-
+ @Nullable
JComponent getSettingsPanel();
- void generateProject(Module module);
+ @NotNull
+ ProjectBuilder createModuleBuilder();
}
diff --git a/platform/platform-resources-en/src/messages/ExecutionBundle.properties b/platform/platform-resources-en/src/messages/ExecutionBundle.properties
index d3995a102dfc..69bc59533e37 100644
--- a/platform/platform-resources-en/src/messages/ExecutionBundle.properties
+++ b/platform/platform-resources-en/src/messages/ExecutionBundle.properties
@@ -160,7 +160,8 @@ terminating.process.progress.kill=Kill process
waiting.for.vm.detach.progress.text=Waiting for process detach
restart.error.message.title=Restart Error
rerun.configuration.action.name=Rerun ''{0}''
-rerun.confirmation.message=''{0}'' is single-instance run configuration.\nAre you sure you want to stop running one?
+rerun.singleton.confirmation.message=''{0}'' is single-instance run configuration.\nAre you sure you want to stop running one?
+rerun.confirmation.message=Are you sure you want to stop ''{0}''?
rerun.confirmation.title=Stop Confirmation
rerun.confirmation.checkbox=Confirm rerun with process termination
run.configuration.dump.threads.action.name=Dump Threads
diff --git a/platform/platform-resources-en/src/messages/VcsBundle.properties b/platform/platform-resources-en/src/messages/VcsBundle.properties
index 3ccbf770ba6a..1e1d895e7620 100644
--- a/platform/platform-resources-en/src/messages/VcsBundle.properties
+++ b/platform/platform-resources-en/src/messages/VcsBundle.properties
@@ -323,9 +323,7 @@ changes.action.rollback.text=Rollback
changes.action.rollback.description=Rollback changes
changes.action.setdefaultchangelist.text=Set Active Changelist
changes.action.setdefaultchangelist.description=Set changelist to which new changes are placed by default
-create.patch.file.name.field=&Patch file name:
-create.patch.commit.action.text=Create Patc_h...
-create.patch.commit.action.description=Creates a patch from the selected changes
+patch.apply.file.name.field=&Patch file name:
create.patch.commit.action.title=Create Patch
create.patch.error.title=Error creating patch: {0}
patch.apply.dialog.title=Apply Patch
@@ -424,7 +422,10 @@ changes.remove.active.prompt=Select the changelist to which the changes should b
changes.remove.active.empty.prompt=Select the changelist to make active:
changes.remove.active.title=Delete Active Changelist
create.patch.loading.content.progress=Loading content revisions
-create.patch.reverse.patch.checkbox=&Reverse patch
+create.patch.reverse.checkbox=&Reverse patch
+create.patch.base.revision=&Include base revision text(s) into patch file
+create.patch.file.path=&Patch file:
+create.patch.encoding=Encoding:
committed.changes.refresh.progress=Refreshing VCS history
cache.settings.dialog.title=VCS History Cache Settings
diff.commit.message.title=Commit Message
@@ -555,7 +556,6 @@ line.annotation.aspect.author=Author
line.annotation.aspect.date=Date
line.annotation.aspect.revision=Revision
annotation.commit.number=Commit number
-create.patch.file.path=&Patch file:
todo.handler.only.skipped=TODO check has skipped {0,choice, 0#|1#one file|2#{0} files}.
\n\
No new, edited, or located in changed fragments TODO items found.
todo.handler.only.added=There {0,choice, 0#|1#was one|2#were {0}} added or edited TODO {0,choice, 0#|1#item|2#items} found.
\
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java
new file mode 100644
index 000000000000..513cb9e82a9b
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/util/text/StringUtilPerformanceTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.util.text;
+
+import com.intellij.testFramework.PlatformTestUtil;
+import com.intellij.util.ThrowableRunnable;
+import org.junit.Test;
+
+import java.util.Random;
+
+import static org.junit.Assert.assertTrue;
+
+public class StringUtilPerformanceTest {
+ private static final String TEST_STRING = "0123456789abcdefghijklmnopqrstuvwxyz";
+
+ @Test
+ public void containsAnyChar() throws Exception {
+ assertTrue(StringUtil.containsAnyChar(TEST_STRING, Integer.toString(new Random().nextInt())));
+
+ PlatformTestUtil.startPerformanceTest("StringUtil.containsAnyChar()", 200, new ThrowableRunnable() {
+ @Override
+ public void run() throws Throwable {
+ for (int i = 0; i < 1000000; i++) {
+ StringUtil.containsAnyChar(TEST_STRING, "XYZ");
+ StringUtil.containsAnyChar("XYZ", TEST_STRING);
+ }
+ }
+ }).cpuBound().assertTiming();
+ }
+}
diff --git a/platform/util-rt/src/com/intellij/util/Consumer.java b/platform/util-rt/src/com/intellij/util/Consumer.java
index 2886971cec98..d00f829b117e 100644
--- a/platform/util-rt/src/com/intellij/util/Consumer.java
+++ b/platform/util-rt/src/com/intellij/util/Consumer.java
@@ -15,6 +15,8 @@
*/
package com.intellij.util;
+import org.jetbrains.annotations.Nullable;
+
public interface Consumer {
Consumer EMPTY_CONSUMER = new Consumer() {
public void consume(final Object t) {
@@ -24,7 +26,7 @@ public interface Consumer {
/**
* @param t consequently takes value of each element of the set this processor is passed to for processing.
*/
- void consume(T t);
+ void consume(@Nullable T t);
}
diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
index ec52a5636d1e..85ca5dd5ba00 100644
--- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
+++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java
@@ -1331,7 +1331,12 @@ public class StringUtil extends StringUtilRt {
}
public static boolean containsAnyChar(@NotNull final String value, @NotNull final String chars) {
- return containsAnyChar(value, chars, 0, value.length());
+ if (chars.length() > value.length()) {
+ return containsAnyChar(value, chars, 0, value.length());
+ }
+ else {
+ return containsAnyChar(chars, value, 0, chars.length());
+ }
}
public static boolean containsAnyChar(@NotNull final String value,
diff --git a/platform/util/src/com/intellij/util/BufferedListConsumer.java b/platform/util/src/com/intellij/util/BufferedListConsumer.java
index cfb0e9eb8aae..6619dc554b7e 100644
--- a/platform/util/src/com/intellij/util/BufferedListConsumer.java
+++ b/platform/util/src/com/intellij/util/BufferedListConsumer.java
@@ -49,8 +49,8 @@ public class BufferedListConsumer implements Consumer> {
if ((mySize <= myBuffer.size()) || (myInterval > 0) && ((ts - myInterval) > myTs)) {
myConsumer.consume(new ArrayList(myBuffer));
myBuffer.clear();
+ myTs = ts;
}
- myTs = ts;
}
public void flushPart() {
diff --git a/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java b/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
index eb72f7f31adc..4fa62cb0ab61 100644
--- a/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
+++ b/platform/vcs-api/src/com/intellij/vcsUtil/VcsUtil.java
@@ -37,7 +37,10 @@ import com.intellij.openapi.vcs.actions.VcsContextFactory;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
-import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.LocalFileSystem;
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileVisitor;
import com.intellij.openapi.vfs.newvfs.RefreshQueue;
import com.intellij.openapi.wm.StatusBar;
import org.jetbrains.annotations.NotNull;
@@ -591,4 +594,8 @@ public class VcsUtil {
}
return idx > 0;
}
+
+ public static String getPathForProgressPresentation(@NotNull final File file) {
+ return file.getName() + " (" + file.getParent() + ")";
+ }
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
index fa756e694778..979949f29b81 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java
@@ -390,7 +390,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
final GridBagConstraints gb =
new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 0, 0);
- myPatchFileLabel = new JLabel(VcsBundle.message("create.patch.file.name.field"));
+ myPatchFileLabel = new JLabel(VcsBundle.message("patch.apply.file.name.field"));
myPatchFileLabel.setLabelFor(myPatchFile);
myCenterPanel.add(myPatchFileLabel, gb);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java
index 0c9aa4e11379..b3b081c14089 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/CreatePatchConfigurationPanel.java
@@ -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.
@@ -150,16 +150,16 @@ public class CreatePatchConfigurationPanel {
private void initMainPanel() {
myFileNameField = new TextFieldWithBrowseButton();
- myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.patch.checkbox"));
+ myReversePatchCheckbox = new JCheckBox(VcsBundle.message("create.patch.reverse.checkbox"));
myEncoding = new JComboBox();
- myIncludeBaseRevisionTextCheckBox = new JCheckBox("Include base revision text(s) into patch file");
+ myIncludeBaseRevisionTextCheckBox = new JCheckBox(VcsBundle.message("create.patch.base.revision"));
myErrorLabel = new JLabel();
myMainPanel = FormBuilder.createFormBuilder()
.addLabeledComponent(VcsBundle.message("create.patch.file.path"), myFileNameField)
.addComponent(myReversePatchCheckbox)
- .addLabeledComponent("Encoding:", myEncoding)
.addComponent(myIncludeBaseRevisionTextCheckBox)
+ .addLabeledComponent(VcsBundle.message("create.patch.encoding"), myEncoding)
.addComponent(myErrorLabel)
.getPanel();
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java
index 8adad110695a..e9d5c2e90bd7 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java
@@ -15,7 +15,10 @@
*/
package com.intellij.openapi.vcs.ui;
+import com.intellij.notification.Notification;
import com.intellij.notification.NotificationGroup;
+import com.intellij.notification.NotificationListener;
+import com.intellij.notification.NotificationType;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
@@ -23,11 +26,14 @@ import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.BalloonBuilder;
import com.intellij.openapi.ui.popup.JBPopupFactory;
+import com.intellij.openapi.util.NamedRunnable;
import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager;
import com.intellij.ui.awt.RelativePoint;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import javax.swing.event.HyperlinkEvent;
import java.awt.*;
import java.util.concurrent.TimeUnit;
@@ -43,32 +49,37 @@ public class VcsBalloonProblemNotifier implements Runnable {
private final String myMessage;
private final MessageType myMessageType;
private final boolean myShowOverChangesView;
+ @Nullable private final NamedRunnable[] myNotificationListener;
public VcsBalloonProblemNotifier(@NotNull final Project project, @NotNull final String message, final MessageType messageType) {
- this(project, message, messageType, true);
+ this(project, message, messageType, true, null);
}
- public VcsBalloonProblemNotifier(@NotNull final Project project, @NotNull final String message, final MessageType messageType, boolean showOverChangesView) {
+ public VcsBalloonProblemNotifier(@NotNull final Project project, @NotNull final String message, final MessageType messageType, boolean showOverChangesView,
+ @Nullable final NamedRunnable[] notificationListener) {
myProject = project;
myMessage = message;
myMessageType = messageType;
myShowOverChangesView = showOverChangesView;
+ myNotificationListener = notificationListener;
}
- public static void showOverChangesView(@NotNull final Project project, @NotNull final String message, final MessageType type) {
- show(project, message, type, true);
+ public static void showOverChangesView(@NotNull final Project project, @NotNull final String message, final MessageType type,
+ final NamedRunnable... notificationListener) {
+ show(project, message, type, true, notificationListener);
}
public static void showOverVersionControlView(@NotNull final Project project, @NotNull final String message, final MessageType type) {
- show(project, message, type, false);
+ show(project, message, type, false, null);
}
- private static void show(final Project project, final String message, final MessageType type, final boolean showOverChangesView) {
+ private static void show(final Project project, final String message, final MessageType type, final boolean showOverChangesView,
+ @Nullable final NamedRunnable[] notificationListener) {
final Application application = ApplicationManager.getApplication();
if (application.isHeadlessEnvironment()) return;
final Runnable showErrorAction = new Runnable() {
public void run() {
- new VcsBalloonProblemNotifier(project, message, type, showOverChangesView).run();
+ new VcsBalloonProblemNotifier(project, message, type, showOverChangesView, notificationListener).run();
}
};
if (application.isDispatchThread()) {
@@ -80,7 +91,40 @@ public class VcsBalloonProblemNotifier implements Runnable {
}
public void run() {
- NOTIFICATION_GROUP.createNotification(myMessage, myMessageType).notify(myProject.isDefault() ? null : myProject);
+ final Notification notification;
+ if (myNotificationListener != null && myNotificationListener.length > 0) {
+ final NotificationType type = myMessageType.toNotificationType();
+ final StringBuilder sb = new StringBuilder(myMessage);
+ for (NamedRunnable runnable : myNotificationListener) {
+ final String name = runnable.toString();
+ sb.append("
").append(name).append("");
+ }
+ notification = NOTIFICATION_GROUP.createNotification(type.name(), sb.toString(), myMessageType.toNotificationType(),
+ new NotificationListener() {
+ @Override
+ public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
+ if (HyperlinkEvent.EventType.ACTIVATED.equals(event.getEventType())) {
+ if (myNotificationListener.length == 1) {
+ myNotificationListener[0].run();
+ } else {
+ final String description = event.getDescription();
+ if (description != null) {
+ for (NamedRunnable runnable : myNotificationListener) {
+ if (description.equals(runnable.toString())) {
+ runnable.run();
+ break;
+ }
+ }
+ }
+ }
+ notification.expire();
+ }
+ }
+ });
+ } else {
+ notification = NOTIFICATION_GROUP.createNotification(myMessage, myMessageType);
+ }
+ notification.notify(myProject.isDefault() ? null : myProject);
}
public static void showBalloonForComponent(@NotNull JComponent component, @NotNull final String message, final MessageType type,
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java
index c42901db8282..87834f74726e 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/UpdateInfoTree.java
@@ -43,6 +43,7 @@ import com.intellij.util.EditSourceOnDoubleClickHandler;
import com.intellij.util.EditSourceOnEnterKeyHandler;
import com.intellij.util.PlatformIcons;
import com.intellij.util.containers.Convertor;
+import com.intellij.util.ui.StatusText;
import com.intellij.util.ui.tree.TreeUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -92,7 +93,7 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di
UpdatedFiles updatedFiles,
String rootName,
ActionInfo actionInfo) {
- super(contentManager, "reference.toolWindows.versionControl");
+ super(contentManager, "reference.versionControl.toolwindow.update");
myActionInfo = actionInfo;
myFileStatusListener = new FileStatusListener() {
@@ -334,8 +335,9 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di
myCommittedChangeLists = receivedChanges;
myTreeBrowser.setItems(myCommittedChangeLists, CommittedChangesBrowserUseCase.UPDATE);
if (hasEmptyCaches) {
- myTreeBrowser.getEmptyText()
- .appendText("Click ")
+ final StatusText statusText = myTreeBrowser.getEmptyText();
+ statusText.clear();
+ statusText.appendText("Click ")
.appendText("Refresh", SimpleTextAttributes.LINK_ATTRIBUTES, new ActionListener() {
public void actionPerformed(final ActionEvent e) {
RefreshIncomingChangesAction.doRefresh(myProject);
diff --git a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidAdditionalRootProviderService.java b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidAdditionalRootProviderService.java
index 96a73f7b6c0d..e23a7d31cf50 100644
--- a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidAdditionalRootProviderService.java
+++ b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidAdditionalRootProviderService.java
@@ -4,8 +4,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.builders.AdditionalRootsProviderService;
import org.jetbrains.jps.builders.BuildTarget;
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
+import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
import org.jetbrains.jps.incremental.ModuleBuildTarget;
-import org.jetbrains.jps.incremental.fs.RootDescriptor;
import java.io.File;
import java.util.ArrayList;
@@ -15,17 +15,17 @@ import java.util.List;
/**
* @author Eugene.Kudelevsky
*/
-public class AndroidAdditionalRootProviderService extends AdditionalRootsProviderService {
+public class AndroidAdditionalRootProviderService extends AdditionalRootsProviderService {
public AndroidAdditionalRootProviderService() {
super(Collections.singletonList(JavaModuleBuildTargetType.PRODUCTION));
}
@NotNull
@Override
- public List getAdditionalRoots(@NotNull BuildTarget target, File dataStorageRoot) {
+ public List getAdditionalRoots(@NotNull BuildTarget target, File dataStorageRoot) {
ModuleBuildTarget buildTarget = (ModuleBuildTarget)target;
final File generatedSourcesRoot = AndroidJpsUtil.getGeneratedSourcesStorage(buildTarget.getModule(), dataStorageRoot);
- final List result = new ArrayList();
+ final List result = new ArrayList();
addRoot(result, buildTarget, new File(generatedSourcesRoot, AndroidJpsUtil.AAPT_GENERATED_SOURCE_ROOT_NAME));
addRoot(result, buildTarget, new File(generatedSourcesRoot, AndroidJpsUtil.AIDL_GENERATED_SOURCE_ROOT_NAME));
@@ -35,7 +35,7 @@ public class AndroidAdditionalRootProviderService extends AdditionalRootsProvide
return result;
}
- private static void addRoot(List result, ModuleBuildTarget buildTarget, final File file) {
- result.add(new RootDescriptor(file, buildTarget, true, false));
+ private static void addRoot(List result, ModuleBuildTarget buildTarget, final File file) {
+ result.add(new JavaSourceRootDescriptor(file, buildTarget, true, false, ""));
}
}
diff --git a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java
index 8a4d0c304ee3..7684f661b890 100644
--- a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java
+++ b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidDexBuilder.java
@@ -110,7 +110,7 @@ public class AndroidDexBuilder extends TargetBuilder
@NotNull AndroidFileSetStorage proguardStateStorage) throws IOException {
boolean success = true;
- for (JpsModule module : context.getProjectDescriptor().jpsProject.getModules()) {
+ for (JpsModule module : context.getProjectDescriptor().getProject().getModules()) {
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
if (extension == null || extension.isLibrary()) {
continue;
@@ -344,7 +344,7 @@ public class AndroidDexBuilder extends TargetBuilder
final JpsSdk> sdk = platform.getSdk();
final String jdkName = sdk.getSdkProperties().getData().getJdkName();
- final JpsLibrary javaSdk = context.getProjectDescriptor().jpsModel.getGlobal().getLibraryCollection().findLibrary(jdkName);
+ final JpsLibrary javaSdk = context.getProjectDescriptor().getModel().getGlobal().getLibraryCollection().findLibrary(jdkName);
if (javaSdk == null || !javaSdk.getType().equals(JpsJavaSdkType.INSTANCE)) {
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, AndroidJpsBundle.message("android.jps.errors.java.sdk.not.specified", jdkName)));
return false;
diff --git a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidLibraryPackagingBuilder.java b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidLibraryPackagingBuilder.java
index d27f6f8e213a..013a36f27553 100644
--- a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidLibraryPackagingBuilder.java
+++ b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidLibraryPackagingBuilder.java
@@ -8,8 +8,8 @@ import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.ProjectPaths;
import org.jetbrains.jps.android.model.JpsAndroidModuleExtension;
import org.jetbrains.jps.builders.DirtyFilesHolder;
+import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
import org.jetbrains.jps.incremental.*;
-import org.jetbrains.jps.incremental.fs.RootDescriptor;
import org.jetbrains.jps.incremental.messages.ProgressMessage;
import org.jetbrains.jps.model.module.JpsModule;
@@ -28,7 +28,7 @@ public class AndroidLibraryPackagingBuilder extends ModuleLevelBuilder {
}
@Override
- public ExitCode build(CompileContext context, ModuleChunk chunk, DirtyFilesHolder dirtyFilesHolder) throws ProjectBuildException {
+ public ExitCode build(CompileContext context, ModuleChunk chunk, DirtyFilesHolder dirtyFilesHolder) throws ProjectBuildException {
if (chunk.containsTests() || !AndroidJpsUtil.containsAndroidFacet(chunk) || AndroidJpsUtil.isLightBuild(context)) {
return ExitCode.NOTHING_DONE;
}
diff --git a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java
index b2a634341f65..2421a9fca633 100644
--- a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java
+++ b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidPackagingBuilder.java
@@ -62,7 +62,7 @@ public class AndroidPackagingBuilder extends TargetBuilder modules = context.getProjectDescriptor().jpsProject.getModules();
+ final Collection modules = context.getProjectDescriptor().getProject().getModules();
final Map resourcesStates = new HashMap();
final Map assetsStates = new HashMap();
final Map manifestFiles = new HashMap();
@@ -384,7 +384,7 @@ public class AndroidPackagingBuilder extends TargetBuilder additionalNativeLibs = extension.getAdditionalNativeLibs();
final AndroidFileSetState currentFileSetState =
- buildCurrentApkBuilderState(context.getProjectDescriptor().jpsProject, resPackagePath, classesDexFilePath, nativeLibDirs, sourceRoots,
+ buildCurrentApkBuilderState(context.getProjectDescriptor().getProject(), resPackagePath, classesDexFilePath, nativeLibDirs, sourceRoots,
externalJars, release);
final AndroidApkBuilderConfigState currentApkBuilderConfigState =
@@ -404,7 +404,7 @@ public class AndroidPackagingBuilder extends TargetBuilder> messages = AndroidApkBuilder
.execute(resPackagePath, classesDexFilePath, sourceRoots, externalJars, nativeLibDirs, additionalNativeLibs,
- outputApkPath, release, sdkPath, customKeyStorePath, new MyExcludedSourcesFilter(context.getProjectDescriptor().jpsProject));
+ outputApkPath, release, sdkPath, customKeyStorePath, new MyExcludedSourcesFilter(context.getProjectDescriptor().getProject()));
AndroidJpsUtil.addMessages(context, messages, BUILDER_NAME, module.getName());
final boolean success = messages.get(AndroidCompilerMessageKind.ERROR).isEmpty();
diff --git a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidSourceGeneratingBuilder.java b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidSourceGeneratingBuilder.java
index d5b7dd222055..fe40f735c8b4 100644
--- a/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidSourceGeneratingBuilder.java
+++ b/plugins/android/jps-plugin/src/org/jetbrains/jps/android/AndroidSourceGeneratingBuilder.java
@@ -23,9 +23,9 @@ import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.android.model.JpsAndroidModuleExtension;
import org.jetbrains.jps.builders.DirtyFilesHolder;
import org.jetbrains.jps.builders.FileProcessor;
+import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
import org.jetbrains.jps.builders.storage.SourceToOutputMapping;
import org.jetbrains.jps.incremental.*;
-import org.jetbrains.jps.incremental.fs.RootDescriptor;
import org.jetbrains.jps.incremental.java.FormsParsing;
import org.jetbrains.jps.incremental.messages.BuildMessage;
import org.jetbrains.jps.incremental.messages.CompilerMessage;
@@ -75,7 +75,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
@Override
public ModuleLevelBuilder.ExitCode build(CompileContext context,
ModuleChunk chunk,
- DirtyFilesHolder dirtyFilesHolder) throws ProjectBuildException {
+ DirtyFilesHolder dirtyFilesHolder) throws ProjectBuildException {
if (chunk.containsTests() || !AndroidJpsUtil.containsAndroidFacet(chunk)) {
return ExitCode.NOTHING_DONE;
}
@@ -90,7 +90,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
private static ModuleLevelBuilder.ExitCode doBuild(CompileContext context,
ModuleChunk chunk,
- DirtyFilesHolder dirtyFilesHolder) throws IOException {
+ DirtyFilesHolder dirtyFilesHolder) throws IOException {
final Map moduleDataMap = computeModuleDatas(chunk.getModules(), context);
if (moduleDataMap == null || moduleDataMap.size() == 0) {
return ExitCode.ABORT;
@@ -110,9 +110,9 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
final Map idlFilesToCompile = new HashMap();
final Map rsFilesToCompile = new HashMap();
- dirtyFilesHolder.processDirtyFiles(new FileProcessor() {
+ dirtyFilesHolder.processDirtyFiles(new FileProcessor() {
@Override
- public boolean apply(ModuleBuildTarget target, File file, RootDescriptor sourceRoot) throws IOException {
+ public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor sourceRoot) throws IOException {
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(target.getModule());
if (extension == null) {
@@ -905,7 +905,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
@Nullable
private static String getDependencyFolder(@NotNull CompileContext context, @NotNull File sourceFile, @NotNull File genFolder) {
- final RootDescriptor descriptor = context.getProjectDescriptor().getBuildRootIndex().getModuleAndRoot(context, sourceFile);
+ final JavaSourceRootDescriptor descriptor = context.getProjectDescriptor().getBuildRootIndex().getModuleAndRoot(context, sourceFile);
if (descriptor == null) {
return null;
}
@@ -975,7 +975,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
@Nullable
private static String computePackageForFile(@NotNull CompileContext context, @NotNull File file) throws IOException {
- final RootDescriptor descriptor = context.getProjectDescriptor().getBuildRootIndex().getModuleAndRoot(context, file);
+ final JavaSourceRootDescriptor descriptor = context.getProjectDescriptor().getBuildRootIndex().getModuleAndRoot(context, file);
if (descriptor == null) {
return null;
}
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java b/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java
index e141ce36d239..3c5a9bdf9a12 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/DetailsCache.java
@@ -156,19 +156,20 @@ public class DetailsCache {
public void run(@NotNull ProgressIndicator indicator) {
if (!recheck.process(abstractHash)) return;
if (getBranches(root, abstractHash) != null) return;
- final List branches;
+ List branches;
try {
branches = new LowLevelAccessImpl(myProject, root).getBranchesWithCommit(abstractHash.getString());
}
catch (VcsException e) {
LOG.info(e);
- return;
+ branches = Collections.singletonList("Can not load branches due to error: " + e.getMessage());
}
putBranches(root, abstractHash, branches);
+ final List finalBranches = branches;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
- continuation.consume(branches);
+ continuation.consume(finalBranches);
}
});
}
diff --git a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
index 5783bdb9d192..c6a67bc14898 100644
--- a/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
+++ b/plugins/groovy/jps-plugin/src/org/jetbrains/jps/incremental/groovy/GroovyBuilder.java
@@ -14,12 +14,12 @@ import org.jetbrains.jps.builders.BuildRootIndex;
import org.jetbrains.jps.builders.DirtyFilesHolder;
import org.jetbrains.jps.builders.FileProcessor;
import org.jetbrains.jps.builders.java.JavaBuilderUtil;
+import org.jetbrains.jps.builders.java.JavaSourceRootDescriptor;
import org.jetbrains.jps.builders.java.dependencyView.Callbacks;
import org.jetbrains.jps.builders.java.dependencyView.Mappings;
import org.jetbrains.jps.builders.storage.SourceToOutputMapping;
import org.jetbrains.jps.cmdline.ClasspathBootstrap;
import org.jetbrains.jps.incremental.*;
-import org.jetbrains.jps.incremental.fs.RootDescriptor;
import org.jetbrains.jps.incremental.java.ClassPostProcessor;
import org.jetbrains.jps.incremental.java.JavaBuilder;
import org.jetbrains.jps.incremental.messages.BuildMessage;
@@ -67,7 +67,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
public ModuleLevelBuilder.ExitCode build(final CompileContext context,
ModuleChunk chunk,
- DirtyFilesHolder dirtyFilesHolder) throws ProjectBuildException {
+ DirtyFilesHolder dirtyFilesHolder) throws ProjectBuildException {
try {
final List toCompile = collectChangedFiles(context, dirtyFilesHolder);
if (toCompile.isEmpty()) {
@@ -136,7 +136,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
final BuildRootIndex rootsIndex = context.getProjectDescriptor().getBuildRootIndex();
for (ModuleBuildTarget target : generationOutputs.keySet()) {
File root = new File(generationOutputs.get(target));
- rootsIndex.associateTempRoot(context, target, new RootDescriptor(root, target, true, true));
+ rootsIndex.associateTempRoot(context, target, new JavaSourceRootDescriptor(root, target, true, true, ""));
}
}
@@ -206,7 +206,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
GroovycOSProcessHandler.OutputItem item, Map generationOutputs, String compilerOutput) throws IOException {
if (chunk.getModules().size() > 1) {
final BuildRootIndex rootsIndex = context.getProjectDescriptor().getBuildRootIndex();
- RootDescriptor descriptor = rootsIndex.getModuleAndRoot(context, new File(item.sourcePath));
+ JavaSourceRootDescriptor descriptor = rootsIndex.getModuleAndRoot(context, new File(item.sourcePath));
if (descriptor != null) {
ModuleBuildTarget srcTarget = descriptor.target;
if (!srcTarget.equals(chunk.representativeTarget())) {
@@ -238,12 +238,12 @@ public class GroovyBuilder extends ModuleLevelBuilder {
}
private static List collectChangedFiles(CompileContext context,
- DirtyFilesHolder dirtyFilesHolder) throws IOException {
+ DirtyFilesHolder dirtyFilesHolder) throws IOException {
final ResourcePatterns patterns = ResourcePatterns.KEY.get(context);
assert patterns != null;
final List toCompile = new ArrayList();
- dirtyFilesHolder.processDirtyFiles(new FileProcessor() {
- public boolean apply(ModuleBuildTarget target, File file, RootDescriptor sourceRoot) throws IOException {
+ dirtyFilesHolder.processDirtyFiles(new FileProcessor() {
+ public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor sourceRoot) throws IOException {
final String path = file.getPath();
if (isGroovyFile(path) && !patterns.isResourceFile(file, sourceRoot.root)) { //todo file type check
toCompile.add(file);
@@ -269,7 +269,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
for (GroovycOSProcessHandler.OutputItem item : successfullyCompiled) {
final String sourcePath = FileUtil.toSystemIndependentName(item.sourcePath);
final String outputPath = FileUtil.toSystemIndependentName(item.outputPath);
- final RootDescriptor moduleAndRoot = context.getProjectDescriptor().getBuildRootIndex().getModuleAndRoot(context, new File(sourcePath));
+ final JavaSourceRootDescriptor moduleAndRoot = context.getProjectDescriptor().getBuildRootIndex().getModuleAndRoot(context, new File(sourcePath));
if (moduleAndRoot != null) {
final ModuleBuildTarget target = moduleAndRoot.target;
context.getProjectDescriptor().dataManager.getSourceToOutputMap(target).appendOutput(sourcePath, outputPath);
@@ -313,7 +313,8 @@ public class GroovyBuilder extends ModuleLevelBuilder {
private static Map buildClassToSourceMap(ModuleChunk chunk, CompileContext context, Set toCompilePaths, Map finalOutputs) throws IOException {
final Map class2Src = new HashMap();
- JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(context.getProjectDescriptor().jpsProject);
+ JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(
+ context.getProjectDescriptor().getProject());
for (ModuleBuildTarget target : chunk.getTargets()) {
String moduleOutputPath = finalOutputs.get(target);
final SourceToOutputMapping srcToOut = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java
index 70fff2d294f6..1e823136398f 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAuthenticationNotifier.java
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.JBPopupFactory;
+import com.intellij.openapi.util.NamedRunnable;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.impl.GenericNotifierImpl;
@@ -33,6 +34,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.ui.awt.RelativePoint;
+import com.intellij.util.Consumer;
import com.intellij.util.ThreeState;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -321,14 +323,37 @@ public class SvnAuthenticationNotifier extends GenericNotifierImpl() {
+ @Override
+ public void consume(String s) {
+ configuration.setConfigurationDirectory(s);
+ }
+ }, project, null);
+ }
+ });
+ }
+ }, ModalityState.NON_MODAL, project.getDisposed());
}
return false; /// !!!! any exception means user should be notified that authorization failed
}
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
index 9db0ae7d40f8..ba6e615f19ff 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties
@@ -154,6 +154,7 @@ status.group.name.locked=Locked
checkbox.configure.use.system.default.configuration.directory=&Use system default Subversion configuration directory
label.configuration.configuration.directory=Subversion configuration &directory:
dialog.title.select.configuration.directory=Select Configuration Directory
+action.title.select.configuration.directory=Change Configuration Directory
dialog.description.select.configuration.directory=Select Subversion configuration directory or create new one
button.text.clear.authentication.cache=&Clear Auth Cache
label.text.delete.stored.credentials=Delete all stored credentials for 'http', 'svn' and 'svn+ssh' protocols
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
index f2eff8947c0e..2a07a18bccd1 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.java
@@ -32,8 +32,11 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.ui.MultiLineTooltipUI;
+import com.intellij.util.Consumer;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.config.ConfigureProxiesListener;
import javax.swing.*;
@@ -93,37 +96,21 @@ public class SvnConfigurable implements Configurable {
myClearAuthButton.addActionListener(new ActionListener(){
public void actionPerformed(final ActionEvent e) {
- String path = myConfigurationDirectoryText.getText();
- if (path != null) {
- int result = Messages.showYesNoDialog(myComponent, SvnBundle.message("confirmation.text.delete.stored.authentication.information"),
- SvnBundle.message("confirmation.title.clear.authentication.cache"),
- Messages.getWarningIcon());
- if (result == 0) {
- SvnConfiguration.RUNTIME_AUTH_CACHE.clear();
- SvnConfiguration.getInstance(myProject).clearAuthenticationDirectory(myProject);
- }
- }
-
+ clearAuthenticationCache(myProject, myComponent, myConfigurationDirectoryText.getText());
}
});
- final FileChooserDescriptor descriptor = createFileDescriptor();
myConfigurationDirectoryText.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
@NonNls String path = myConfigurationDirectoryText.getText().trim();
- path = "file://" + path.replace(File.separatorChar, '/');
- VirtualFile root = VirtualFileManager.getInstance().findFileByUrl(path);
-
- String oldValue = PropertiesComponent.getInstance().getValue("FileChooser.showHiddens");
- PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", Boolean.TRUE.toString());
- VirtualFile file = FileChooser.chooseFile(descriptor, myComponent, myProject, root);
- PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", oldValue);
- if (file == null) {
- return;
- }
- myConfigurationDirectoryText.setText(file.getPath().replace('/', File.separatorChar));
+ selectConfigirationDirectory(path, new Consumer() {
+ @Override
+ public void consume(String s) {
+ myConfigurationDirectoryText.setText(s);
+ }
+ }, myProject, myComponent);
}
});
myConfigurationDirectoryText.setEditable(false);
@@ -150,6 +137,42 @@ public class SvnConfigurable implements Configurable {
myJavaHLInfo.setVisible(internal);
}
+ public static void selectConfigirationDirectory(@NotNull String path, @NotNull final Consumer dirConsumer,
+ final Project project, @Nullable final Component component) {
+ final FileChooserDescriptor descriptor = createFileDescriptor();
+ path = "file://" + path.replace(File.separatorChar, '/');
+ VirtualFile root = VirtualFileManager.getInstance().findFileByUrl(path);
+
+ String oldValue = PropertiesComponent.getInstance().getValue("FileChooser.showHiddens");
+ PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", Boolean.TRUE.toString());
+ VirtualFile file = FileChooser.chooseFile(descriptor, component, project, root);
+ PropertiesComponent.getInstance().setValue("FileChooser.showHiddens", oldValue);
+ if (file == null) {
+ return;
+ }
+ final String resultPath = file.getPath().replace('/', File.separatorChar);
+ dirConsumer.consume(resultPath);
+ }
+
+ public static void clearAuthenticationCache(@NotNull final Project project, final Component component, final String configDirPath) {
+ if (configDirPath != null) {
+ int result;
+ if (component == null) {
+ result = Messages.showYesNoDialog(project, SvnBundle.message("confirmation.text.delete.stored.authentication.information"),
+ SvnBundle.message("confirmation.title.clear.authentication.cache"),
+ Messages.getWarningIcon());
+ } else {
+ result = Messages.showYesNoDialog(component, SvnBundle.message("confirmation.text.delete.stored.authentication.information"),
+ SvnBundle.message("confirmation.title.clear.authentication.cache"),
+ Messages.getWarningIcon());
+ }
+ if (result == 0) {
+ SvnConfiguration.RUNTIME_AUTH_CACHE.clear();
+ SvnConfiguration.getInstance(project).clearAuthenticationDirectory(project);
+ }
+ }
+ }
+
private static FileChooserDescriptor createFileDescriptor() {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setShowFileSystemRoots(true);
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
index 4a2d3639c9cb..e4e98fde84aa 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfiguration.java
@@ -488,7 +488,7 @@ public class SvnConfiguration implements PersistentStateComponent {
public static class AuthStorage implements ISVNAuthenticationStorage {
- private final Map myStorage = new Hashtable();
+ private final Map myStorage = Collections.synchronizedMap(new HashMap());
public void clear() {
myStorage.clear();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java
index 74fb6ad2e98e..e02861a0646f 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnVcs.java
@@ -185,12 +185,13 @@ public class SvnVcs extends AbstractVcs {
}
static {
- SVNJNAUtil.setJNAEnabled(true);
- SvnHttpAuthMethodsDefaultChecker.check();
-
//noinspection UseOfArchaicSystemPropertyAccessors
final JavaSVNDebugLogger logger = new JavaSVNDebugLogger(Boolean.getBoolean(LOG_PARAMETER_NAME), LOG);
SVNDebugLog.setDefaultLog(logger);
+
+ SVNJNAUtil.setJNAEnabled(true);
+ SvnHttpAuthMethodsDefaultChecker.check();
+
SVNAdminAreaFactory.setSelector(new SvnFormatSelector());
DAVRepositoryFactory.setup();
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java
index 2e7acdecdb05..f1310cdd7fd9 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/SvnFormatWorker.java
@@ -26,6 +26,7 @@ import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.LocalChangeList;
+import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnUtil;
@@ -35,6 +36,7 @@ import org.tmatesoft.svn.core.SVNCancelException;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.wc.ISVNEventHandler;
import org.tmatesoft.svn.core.wc.SVNEvent;
+import org.tmatesoft.svn.core.wc.SVNEventAction;
import org.tmatesoft.svn.core.wc.SVNWCClient;
import java.io.File;
@@ -124,10 +126,14 @@ public class SvnFormatWorker extends Task.Backgroundable {
wcClient.setEventHandler(new ISVNEventHandler() {
@Override
public void handleEvent(SVNEvent event, double progress) throws SVNException {
+ if (SVNEventAction.UPGRADED_PATH.equals(event.getAction()) && event.getFile() != null) {
+ indicator.setText2("Upgraded path " + VcsUtil.getPathForProgressPresentation(event.getFile()));
+ }
}
+
@Override
public void checkCancelled() throws SVNCancelException {
- if (indicator.isCanceled()) throw new SVNCancelException();
+ indicator.checkCanceled();
}
});
try {
diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml
index 87defe6bb3a2..13e43d7f7ccb 100644
--- a/resources/src/idea/RichPlatformPlugin.xml
+++ b/resources/src/idea/RichPlatformPlugin.xml
@@ -297,7 +297,7 @@
-
+