Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Trofimov
2014-04-04 12:52:23 +02:00
46 changed files with 121 additions and 97 deletions
-1
View File
@@ -4148,7 +4148,6 @@ com/intellij/psi/search/scope/packageSet/ParsingException.class:/lib/openapi.jar
com/intellij/packageDependencies/DependencyValidationManagerImpl.class:/lib/idea.jar
com/intellij/psi/search/scope/packageSet/NamedScope.class:/lib/openapi.jar
com/intellij/psi/search/scope/packageSet/NamedScope$UnnamedScope.class:/lib/openapi.jar
ide/sharedScope.png:/lib/icons.jar
com/intellij/packageDependencies/DependencyValidationManagerImpl$1.class:/lib/idea.jar
com/intellij/ide/startup/impl/StartupManagerImpl$4.class:/lib/idea.jar
com/intellij/psi/search/scope/packageSet/PackageSetFactory.class:/lib/openapi.jar
+1
View File
@@ -53,6 +53,7 @@
<orderEntry type="library" name="Velocity" level="project" />
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
<orderEntry type="module" module-name="java-structure-view" exported="" />
<orderEntry type="module" module-name="spellchecker" />
</component>
<component name="copyright">
<Base>
@@ -23,6 +23,8 @@ import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInsight.daemon.QuickFixBundle;
import com.intellij.codeInsight.daemon.impl.quickfix.LocateLibraryDialog;
import com.intellij.codeInsight.daemon.impl.quickfix.OrderEntryFix;
import com.intellij.history.LocalHistory;
import com.intellij.history.LocalHistoryAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.Result;
@@ -207,17 +209,23 @@ public class InferNullityAnnotationsAction extends BaseAnalysisAction {
final Runnable applyRunnable = new Runnable() {
@Override
public void run() {
new WriteCommandAction(project, INFER_NULLITY_ANNOTATIONS) {
@Override
protected void run(Result result) throws Throwable {
if (!inferrer.nothingFoundMessage(project)) {
final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, INFER_NULLITY_ANNOTATIONS, false);
progressTask.setMinIterationTime(200);
progressTask.setTask(new AnnotateTask(project, inferrer, progressTask));
ProgressManager.getInstance().run(progressTask);
final LocalHistoryAction action = LocalHistory.getInstance().startAction(INFER_NULLITY_ANNOTATIONS);
try {
new WriteCommandAction(project, INFER_NULLITY_ANNOTATIONS) {
@Override
protected void run(Result result) throws Throwable {
if (!inferrer.nothingFoundMessage(project)) {
final SequentialModalProgressTask progressTask = new SequentialModalProgressTask(project, INFER_NULLITY_ANNOTATIONS, false);
progressTask.setMinIterationTime(200);
progressTask.setTask(new AnnotateTask(project, inferrer, progressTask));
ProgressManager.getInstance().run(progressTask);
}
}
}
}.execute();
}.execute();
}
finally {
action.finish();
}
}
};
SwingUtilities.invokeLater(applyRunnable);
@@ -115,6 +115,9 @@ public class ImplementationsViewTest extends LightCodeInsightFixtureTestCase {
new ImplementationViewComponent(all.toArray(new PsiElement[all.size()]), 0);
try {
final String[] visibleFiles = component.getVisibleFiles();
assertTrue(visibleFiles.length > 0);
assertEquals(visibleFiles[0], "a.java (AFoo)");
Arrays.sort(visibleFiles);
Assert.assertArrayEquals(Arrays.toString(visibleFiles),
new String[]{"a.java (AFoo)", "a.java (AFoo1 in AFoo)", "a.java (AFoo2 in AFoo)", "a.java (AFoo3 in AFoo)"}, visibleFiles);
}
BIN
View File
Binary file not shown.
Binary file not shown.
@@ -25,6 +25,7 @@ import com.intellij.openapi.util.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.scope.packageSet.*;
import com.intellij.ui.LayeredIcon;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.text.UniqueNameGenerator;
import com.intellij.util.ui.UIUtil;
@@ -46,6 +47,7 @@ import java.util.*;
)
public class DependencyValidationManagerImpl extends DependencyValidationManager {
private static final Logger LOG = Logger.getInstance("#com.intellij.packageDependencies.DependencyValidationManagerImpl");
public static final Icon SHARED_SCOPE_ICON = new LayeredIcon(AllIcons.Ide.LocalScope, AllIcons.Nodes.Shared);
private final List<DependencyRule> myRules = new ArrayList<DependencyRule>();
private final NamedScopeManager myNamedScopeManager;
@@ -194,7 +196,7 @@ public class DependencyValidationManagerImpl extends DependencyValidationManager
@Override
public Icon getIcon() {
return AllIcons.Ide.SharedScope;
return SHARED_SCOPE_ICON;
}
@Override
Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

@@ -330,15 +330,6 @@ public class ImplementationViewComponent extends JPanel {
names.add(((PsiNamedElement)element).getName());
}
}
Arrays.sort(elements, new Comparator<PsiElement>() {
@Override
public int compare(PsiElement e1, PsiElement e2) {
if (e1 instanceof PsiNamedElement && e2 instanceof PsiNamedElement) {
return Comparing.compare(((PsiNamedElement)e1).getName(), ((PsiNamedElement)e2).getName());
}
return e1.hashCode() - e2.hashCode();
}
});
for (PsiElement element : elements) {
PsiFile file = getContainingFile(element);
if (file == null) continue;
@@ -33,7 +33,6 @@ 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.Comparing;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Trinity;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -77,7 +76,7 @@ class RunConfigurable extends BaseConfigurable {
private static final Icon ADD_ICON = IconUtil.getAddIcon();
private static final Icon REMOVE_ICON = IconUtil.getRemoveIcon();
private static final Icon SHARED_ICON = IconLoader.getTransparentIcon(AllIcons.Nodes.Symlink, .6f);
private static final Icon SHARED_ICON = AllIcons.Nodes.Shared;
private static final Icon NON_SHARED_ICON = EmptyIcon.ICON_16;
@NonNls private static final String DIVIDER_PROPORTION = "dividerProportion";
@NonNls private static final Object DEFAULTS = new Object() {
@@ -203,9 +202,7 @@ class RunConfigurable extends BaseConfigurable {
}
if (shared != null) {
Icon icon = getIcon();
LayeredIcon layeredIcon = new LayeredIcon(2);
layeredIcon.setIcon(icon, 0, 0, 0);
layeredIcon.setIcon(shared ? SHARED_ICON : NON_SHARED_ICON, 1, 8, 0);
LayeredIcon layeredIcon = new LayeredIcon(icon, shared ? SHARED_ICON : NON_SHARED_ICON);
setIcon(layeredIcon);
setIconTextGap(0);
} else {
@@ -218,7 +218,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
}, ", ") + ".";
}
}
message += " Disabled plugins and plugins which depends on disabled plugins won't be activated after restart.";
message += " Disabled plugins " + (disabled.isEmpty() ? "and plugins which depend on disabled " :"") + "won't be activated after restart.";
int result;
if (!disabled.isEmpty() && !disabledDependants.isEmpty()) {
@@ -237,8 +237,8 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
//noinspection SpellCheckingInspection
message += "plugin dependenc" + (disabledDependants.size() > 1 ? "ies" : "y");
}
message += "?</body></html>";
result = Messages.showYesNoDialog(message, CommonBundle.getWarningTitle(), Messages.getQuestionIcon());
message += "?";
result = Messages.showYesNoDialog(XmlStringUtil.wrapInHtml(message), CommonBundle.getWarningTitle(), Messages.getQuestionIcon());
if (result == Messages.NO) return false;
}
@@ -159,7 +159,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
@NotNull
private VirtualFilePointer create(@Nullable VirtualFile file,
@NotNull String url,
@NotNull final Disposable parentDisposable,
@NotNull Disposable parentDisposable,
@Nullable VirtualFilePointerListener listener) {
String protocol;
VirtualFileSystem fileSystem;
@@ -171,11 +171,13 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
protocol = null;
fileSystem = file.getFileSystem();
}
if (fileSystem == TEMP_FILE_SYSTEM) {
// for tests, recreate always
VirtualFile found = file == null ? VirtualFileManager.getInstance().findFileByUrl(url) : file;
return new IdentityVirtualFilePointer(found, url);
}
if (fileSystem != LOCAL_FILE_SYSTEM && fileSystem != JAR_FILE_SYSTEM) {
// we are unable to track alien file systems for now
VirtualFile found = fileSystem == null ? null : file != null ? file : VirtualFileManager.getInstance().findFileByUrl(url);
@@ -190,14 +192,11 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
url = VirtualFileManager.constructUrl(protocol, path);
}
else {
path = file.getPath();
// url has come from VirtualFile.getUrl() and is good enough
path = file.getPath(); // url has come from VirtualFile.getUrl() and is good enough
}
VirtualFilePointerImpl pointer = getOrCreate(parentDisposable, listener, path, Pair.create(file, url));
DelegatingDisposable.registerDisposable(parentDisposable, pointer);
return pointer;
}
@@ -310,13 +309,14 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
}
}
private final Set<VirtualFilePointerImpl> myStoredPointers = ContainerUtil.<VirtualFilePointerImpl>newIdentityTroveSet();
private final Set<VirtualFilePointerImpl> myStoredPointers = ContainerUtil.newIdentityTroveSet();
@TestOnly
public void storePointers() {
//assert myStoredPointers.isEmpty() : myStoredPointers;
myStoredPointers.clear();
addAllPointers(myStoredPointers);
}
@TestOnly
public void assertPointersAreDisposed() {
List<VirtualFilePointerImpl> pointers = new ArrayList<VirtualFilePointerImpl>();
@@ -422,7 +422,7 @@ public class VirtualFilePointerManagerImpl extends VirtualFilePointerManager imp
final VFileMoveEvent moveEvent = (VFileMoveEvent)event;
VirtualFile eventFile = moveEvent.getFile();
addPointersUnder(moveEvent.getNewParent().getPath() + "/" + eventFile.getName(), toFireEvents);
List<FilePointerPartNode> nodes = new ArrayList<FilePointerPartNode>();
addPointersUnder(eventFile.getPath(), nodes);
for (FilePointerPartNode pair : nodes) {
@@ -133,7 +133,7 @@ ide.mac.message.dialogs.as.sheets=true
skip.untitled.windows.for.mac.messages=false
skip.untitled.windows.for.mac.messages.description=Temporary key to test a fix for MacMessages
ide.mac.mountain.lion.notifications.enabled=true
ide.mac.inplaceDialogMnemonicsFix=true
ide.mac.inplaceDialogMnemonicsFix=false
ide.mac.fix.dialog.showing=false
ide.mac.hide.cursor.when.typing=true
ide.mac.show.native.help=true
@@ -380,4 +380,4 @@ ide.scratch.enabled=false
editor.injected.highlighting.enabled=true
editor.injected.highlighting.enabled.description=Disables injected fragments highlighting (requires project reopening)
run.processes.with.pty=false
run.processes.with.pty=false
@@ -4,6 +4,15 @@
<keyboard-shortcut first-keystroke="meta P"/>
</action>
<action id="$Delete">
<keyboard-shortcut first-keystroke="DELETE"/>
<keyboard-shortcut first-keystroke="BACK_SPACE"/>
<keyboard-shortcut first-keystroke="meta BACK_SPACE"/>
</action>
<action id="EditorDelete">
<keyboard-shortcut first-keystroke="DELETE"/>
</action>
<action id="NextSplitter">
<keyboard-shortcut first-keystroke="alt TAB"/>
@@ -69,7 +69,7 @@
<action id="DuplicatesForm.SendToRight" />
<action id="$Cut">
<keyboard-shortcut first-keystroke="meta X"/>
<keyboard-shortcut first-keystroke="meta X"/> <!--disable shift DELETE-->
</action>
<action id="$Delete">
<keyboard-shortcut first-keystroke="BACK_SPACE"/>
@@ -139,7 +139,7 @@
<!-- generic delete actions should go last to allow redefining shortcuts by more specific actions in the editor -->
<!-- e.g. Cmd + Backspace on OS X should work as Delete in lists, and as 'Delete to Line Start' in the editor -->
<action id="EditorDelete" class="com.intellij.openapi.editor.actions.DeleteAction" use-shortcut-of="$Dlete"/>
<action id="EditorDelete" class="com.intellij.openapi.editor.actions.DeleteAction" use-shortcut-of="$Delete"/>
<action id="EditorBackSpace" class="com.intellij.openapi.editor.actions.BackspaceAction"/>
</group>
@@ -113,11 +113,15 @@ public interface ModifiableRootModel extends ModuleRootModel {
* Commits changes to a <code>{@link ModuleRootManager}</code>.
* Should be invoked in a write action. After <code>commit()<code>, the model
* becomes read-only.
*
* Use of ModuleRootModificationUtil.updateModel() is recommended.
*/
void commit();
/**
* Must be invoked for uncommited models that are no longer needed.
* Must be invoked for uncommitted models that are no longer needed.
*
* Use of ModuleRootModificationUtil.updateModel() is recommended.
*/
void dispose();
@@ -261,6 +261,7 @@ public class DirectoryInfo {
}
};
@Nullable
public VirtualFile getSourceRoot() {
return sourceRoot;
}
@@ -273,6 +274,7 @@ public class DirectoryInfo {
return getLibraryClassRoot() != null;
}
@Nullable
public VirtualFile getContentRoot() {
return contentRoot;
}
@@ -629,7 +629,6 @@ public class AllIcons {
public static final Icon Top = IconLoader.getIcon("/ide/shadow/top.png"); // 1x20
}
public static final Icon SharedScope = IconLoader.getIcon("/ide/sharedScope.png"); // 16x16
public static final Icon Statusbar_arrows = IconLoader.getIcon("/ide/statusbar_arrows.png"); // 7x10
public static final Icon UpDown = IconLoader.getIcon("/ide/upDown.png"); // 16x16
public static final Icon Warning_notifications = IconLoader.getIcon("/ide/warning_notifications.png"); // 16x16
@@ -848,6 +847,7 @@ public class AllIcons {
public static final Icon Rw_access = IconLoader.getIcon("/nodes/rw-access.png"); // 13x9
public static final Icon SecurityRole = IconLoader.getIcon("/nodes/SecurityRole.png"); // 16x16
public static final Icon Servlet = IconLoader.getIcon("/nodes/servlet.png"); // 16x16
public static final Icon Shared = IconLoader.getIcon("/nodes/shared.png"); // 16x16
public static final Icon SortBySeverity = IconLoader.getIcon("/nodes/sortBySeverity.png"); // 16x16
public static final Icon SourceFolder = IconLoader.getIcon("/nodes/sourceFolder.png"); // 16x16
public static final Icon Static = IconLoader.getIcon("/nodes/static.png"); // 16x16
@@ -87,7 +87,7 @@ public class FileUtilLightTest {
}
@Test
public void isAncestor() throws Exception {
public void isAncestor() {
assertTrue(FileUtil.isAncestor("/", "/a/", true));
assertTrue(FileUtil.isAncestor("/a/b/c", "/a/b/c/d/e/f", true));
assertTrue(FileUtil.isAncestor("/a/b/c/", "/a/b/c/d/e/f", true));
@@ -105,7 +105,7 @@ public class FileUtilLightTest {
}
@Test
public void testRemoveAncestors() throws Exception {
public void testRemoveAncestors() {
List<String> data = Arrays.asList("/a/b/c", "/a", "/a/b", "/d/e", "/b/c", "/a/d", "/b/c/ttt", "/a/ewq.euq");
String[] expected = {"/a","/b/c","/d/e"};
@SuppressWarnings("unchecked") Collection<String> result = FileUtil.removeAncestors(data, Convertor.SELF, PairProcessor.TRUE);
@@ -113,7 +113,7 @@ public class FileUtilLightTest {
}
@Test
public void testCheckImmediateChildren() throws Exception {
public void testCheckImmediateChildren() {
String root = "/a";
String[] data = {"/a/b/c", "/a", "/a/b", "/d/e", "/b/c", "/a/d", "/a/b/c/d/e"};
ThreeState[] expected1 = {ThreeState.UNSURE, ThreeState.YES, ThreeState.YES, ThreeState.NO, ThreeState.NO, ThreeState.YES, ThreeState.UNSURE};
@@ -797,7 +797,7 @@ teardown.calls.super.teardown.display.name='tearDown()' does not call 'super.tea
synchronize.on.lock.display.name=Synchronization on a Lock object
synchronized.on.literal.object.name=Synchronization on an object initialized with a literal
field.may.be.static.display.name=Field may be 'static'
class.may.be.interface.display.name=Class may be interface
class.may.be.interface.display.name=Abstract class may be interface
abstract.class.without.abstract.methods.display.name=Abstract class without abstract methods
divide.by.zero.display.name=Divide by zero
default.not.last.case.in.switch.display.name='default' not last case in 'switch' statement
@@ -902,7 +902,7 @@ anonymous.inner.class.problem.descriptor=Anonymous inner class <code>#ref</code>
limited.scope.inner.class.problem.descriptor=Limited-scope inner class <code>#ref</code> #loc
final.method.problem.descriptor=Method declared <code>#ref</code> #loc
class.initializer.problem.descriptor=Non-'static' initializer #loc
class.may.be.interface.problem.descriptor=<code>#ref</code> may be interface #loc
class.may.be.interface.problem.descriptor=Abstract class <code>#ref</code> may be interface #loc
non.protected.constructor.in.abstract.class.problem.descriptor=Constructor <code>#ref()</code> is not declared 'protected' in 'abstract' class #loc
class.without.constructor.problem.descriptor=Class <code>#ref</code> has no constructor #loc
abstract.class.without.abstract.methods.problem.descriptor=Class <code>#ref</code> is declared 'abstract', and has no 'abstract' methods #loc
@@ -24,7 +24,7 @@ import com.siyeh.ig.LightInspectionTestCase;
public class ClassMayBeInterfaceInspectionTest extends LightInspectionTestCase {
public void testOne() {
doTest("abstract class /*'ConvertMe' may be interface*/ConvertMe/**/ {\n" +
doTest("abstract class /*Abstract class 'ConvertMe' may be interface*/ConvertMe/**/ {\n" +
" public static final String S = \"\";\n" +
" public void m() {}\n" +
" public static void n() {\n" +
@@ -686,7 +686,7 @@ public class AntExplorer extends SimpleToolWindowPanel implements DataProvider,
public RemoveMetaTargetsOrBuildFileAction() {
super(AntBundle.message("remove.meta.targets.action.name"), AntBundle.message("remove.meta.targets.action.description"), null);
registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)), myTree);
registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree);
Disposer.register(AntExplorer.this, new Disposable() {
public void dispose() {
RemoveMetaTargetsOrBuildFileAction.this.unregisterCustomShortcutSet(myTree);
+8 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -26,19 +26,24 @@ import org.jetbrains.idea.devkit.dom.impl.ExtensionNsConverter;
import java.util.List;
public interface Extensions extends DomElement {
@NotNull
@Attribute("defaultExtensionNs")
@Convert(value=ExtensionNsConverter.class, soft=true)
@Convert(value = ExtensionNsConverter.class, soft = true)
@Stubbed
GenericAttributeValue<IdeaPlugin> getDefaultExtensionNs();
@NotNull
@Convert(value=ExtensionNsConverter.class, soft=true)
@Convert(value = ExtensionNsConverter.class, soft = true)
@Stubbed
GenericAttributeValue<IdeaPlugin> getXmlns();
List<Extension> getExtensions();
Extension addExtension();
Extension addExtension(String name);
@NotNull
String getEpPrefix();
}
@@ -136,23 +136,17 @@ public class ExtensionDomExtender extends DomExtender<Extensions> {
if (ideaPlugin == null) return;
String prefix = getEpPrefix(extensions);
String epPrefix = extensions.getEpPrefix();
for (IdeaPlugin plugin : getVisiblePlugins(ideaPlugin)) {
final String pluginId = StringUtil.notNullize(plugin.getPluginId(), "com.intellij");
for (ExtensionPoints points : plugin.getExtensionPoints()) {
for (ExtensionPoint point : points.getExtensionPoints()) {
registerExtensionPoint(registrar, point, prefix, pluginId);
registerExtensionPoint(registrar, point, epPrefix, pluginId);
}
}
}
}
private static String getEpPrefix(Extensions extensions) {
String prefix = extensions.getDefaultExtensionNs().getStringValue();
if (prefix == null) prefix = extensions.getXmlns().getStringValue();
return prefix != null ? prefix + "." : "";
}
private static Set<IdeaPlugin> getVisiblePlugins(IdeaPlugin ideaPlugin) {
Set<IdeaPlugin> result = ContainerUtil.newHashSet();
MultiMap<String, IdeaPlugin> byId = getPluginMap(ideaPlugin.getManager().getProject());
@@ -184,15 +178,15 @@ public class ExtensionDomExtender extends DomExtender<Extensions> {
private static void registerExtensionPoint(final DomExtensionsRegistrar registrar,
final ExtensionPoint extensionPoint,
String prefix,
String epPrefix,
@Nullable String pluginId) {
String epName = extensionPoint.getName().getStringValue();
if (epName != null && StringUtil.isNotEmpty(pluginId)) epName = pluginId + "." + epName;
if (epName == null) epName = extensionPoint.getQualifiedName().getStringValue();
if (epName == null) return;
if (!epName.startsWith(prefix)) return;
if (!epName.startsWith(epPrefix)) return;
final DomExtension domExtension = registrar.registerCollectionChildrenExtension(new XmlName(epName.substring(prefix.length())), Extension.class);
final DomExtension domExtension = registrar.registerCollectionChildrenExtension(new XmlName(epName.substring(epPrefix.length())), Extension.class);
domExtension.setDeclaringElement(extensionPoint);
domExtension.addExtender(EXTENSION_EXTENDER);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2014 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,10 +15,7 @@
*/
package org.jetbrains.idea.devkit.dom.impl;
import com.intellij.pom.PomTarget;
import com.intellij.pom.PomTargetPsiElement;
import com.intellij.psi.PsiElement;
import com.intellij.util.xml.DomTarget;
import com.intellij.util.xml.DomElement;
import org.jetbrains.idea.devkit.dom.Extension;
import org.jetbrains.idea.devkit.dom.ExtensionPoint;
@@ -30,10 +27,9 @@ public abstract class ExtensionImpl implements Extension {
@Override
public ExtensionPoint getExtensionPoint() {
PsiElement declaration = getChildDescription().getDeclaration(getManager().getProject());
if (declaration instanceof PomTargetPsiElement) {
PomTarget target = ((PomTargetPsiElement)declaration).getTarget();
return target instanceof DomTarget ? (ExtensionPoint)((DomTarget)target).getDomElement() : null;
final DomElement domDeclaration = getChildDescription().getDomDeclaration();
if (domDeclaration instanceof ExtensionPoint) {
return (ExtensionPoint)domDeclaration;
}
return null;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package org.jetbrains.idea.devkit.dom.impl;
import com.intellij.psi.xml.XmlTag;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.dom.Extension;
import org.jetbrains.idea.devkit.dom.Extensions;
@@ -32,4 +33,11 @@ public abstract class ExtensionsImpl implements Extensions {
tag.setName(name.substring(getDefaultExtensionNs().getStringValue().length() + 1));
return extension;
}
@NotNull
public String getEpPrefix() {
String prefix = getDefaultExtensionNs().getStringValue();
if (prefix == null) prefix = getXmlns().getStringValue();
return prefix != null ? prefix + "." : "";
}
}
@@ -20,24 +20,24 @@
*/
package org.jetbrains.idea.eclipse;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ModuleRootModel;
import com.intellij.openapi.roots.ModuleRootModificationUtil;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.IdeaTestCase;
import junit.framework.Assert;
import com.intellij.util.Consumer;
import com.intellij.util.containers.ContainerUtil;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
@@ -48,8 +48,7 @@ import org.jetbrains.idea.eclipse.conversion.EclipseClasspathWriter;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
public class EclipseClasspathTest extends IdeaTestCase {
@Override
@@ -73,31 +72,35 @@ public class EclipseClasspathTest extends IdeaTestCase {
checkModule(path, setUpModule(path, project));
}
static Module setUpModule(final String path, @NotNull final Project project)
throws IOException, JDOMException, ConversionException, ConfigurationException {
static Module setUpModule(final String path, @NotNull final Project project) throws Exception {
final File classpathFile = new File(path, EclipseXml.DOT_CLASSPATH_EXT);
String fileText = FileUtil.loadFile(classpathFile).replaceAll("\\$ROOT\\$", project.getBaseDir().getPath());
if (!SystemInfo.isWindows) {
fileText = fileText.replaceAll(EclipseXml.FILE_PROTOCOL + "/", EclipseXml.FILE_PROTOCOL);
}
final Element classpathElement = JDOMUtil.loadDocument(fileText).getRootElement();
final Module module = WriteCommandAction.runWriteCommandAction(null, new Computable<Module>() {
@Override
public Module compute() {
return ModuleManager.getInstance(project)
.newModule(path + "/" + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT, StdModuleTypes.JAVA.getId());
String imlPath = path + "/" + EclipseProjectFinder.findProjectName(path) + IdeaXml.IML_EXT;
return ModuleManager.getInstance(project).newModule(imlPath, StdModuleTypes.JAVA.getId());
}
});
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
final EclipseClasspathReader classpathReader = new EclipseClasspathReader(path, project, null);
classpathReader.init(rootModel);
classpathReader
.readClasspath(rootModel, new ArrayList<String>(), new ArrayList<String>(), new HashSet<String>(), new HashSet<String>(), null,
classpathElement);
new EclipseClasspathStorageProvider().assertCompatible(rootModel);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
rootModel.commit();
ModuleRootModificationUtil.updateModel(module, new Consumer<ModifiableRootModel>() {
@Override
public void consume(ModifiableRootModel model) {
try {
final Set<String> sink = ContainerUtil.newHashSet();
final EclipseClasspathReader classpathReader = new EclipseClasspathReader(path, project, null);
classpathReader.init(model);
classpathReader.readClasspath(model, sink, sink, sink, sink, null, classpathElement);
new EclipseClasspathStorageProvider().assertCompatible(model);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
return module;
@@ -116,8 +119,8 @@ public class EclipseClasspathTest extends IdeaTestCase {
new EclipseClasspathWriter(model).writeClasspath(resultClasspathElement, classpathElement1);
String resulted = new String(JDOMUtil.printDocument(new Document(resultClasspathElement), "\n"));
Assert.assertTrue(resulted.replaceAll(StringUtil.escapeToRegexp(module.getProject().getBaseDir().getPath()), "\\$ROOT\\$"),
JDOMUtil.areElementsEqual(classpathElement1, resultClasspathElement));
assertTrue(resulted.replaceAll(StringUtil.escapeToRegexp(module.getProject().getBaseDir().getPath()), "\\$ROOT\\$"),
JDOMUtil.areElementsEqual(classpathElement1, resultClasspathElement));
}
@@ -35,6 +35,7 @@ import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -114,6 +115,7 @@ public abstract class AbstractModelBuilderTest {
DefaultGradleConnector gradleConnector = (DefaultGradleConnector)connector;
gradleConnector.useGradleVersion(gradleVersion);
gradleConnector.forProjectDirectory(testDir);
gradleConnector.daemonMaxIdleTime(1, TimeUnit.SECONDS);
ProjectConnection connection = gradleConnector.connect();
final ProjectImportAction projectImportAction = new ProjectImportAction(false);
@@ -26,7 +26,6 @@
<psi.referenceContributor implementation="com.intellij.lang.properties.PropertiesReferenceContributor"/>
<lang.foldingBuilder language="JAVA" implementationClass="com.intellij.codeInspection.i18n.folding.PropertyFoldingBuilder" />
<gotoDeclarationHandler implementation="com.intellij.codeInspection.i18n.folding.I18nMessageGotoDeclarationHandler" order="FIRST"/>
<spellchecker.support language="JAVA" implementationClass="com.intellij.spellchecker.JavaSpellcheckingStrategy"/>
<localInspection shortName="HardCodedStringLiteral" bundle="messages.CodeInsightBundle" key="inspection.i18n.display.name"
groupBundle="messages.InspectionsBundle" groupKey="group.names.internationalization.issues" enabledByDefault="false" level="WARNING"
@@ -318,7 +318,7 @@ public class TestNGConfigurationEditor extends SettingsEditor<TestNGConfiguratio
model.apply(getModuleSelector().getModule(), config);
getModuleSelector().applyTo(config);
TestData data = config.getPersistantData();
if (packageTest.isSelected()) {
if (!classTest.isSelected() && !methodTest.isSelected()) {
if (packagesInProject.isSelected()) {
data.setScope(TestSearchScope.WHOLE_PROJECT);
}
+1
View File
@@ -1470,6 +1470,7 @@
<projectOpenProcessor implementation="com.intellij.platform.PlatformProjectOpenProcessor" order="last"/>
<projectService serviceInterface="com.intellij.platform.ProjectBaseDirectory"
serviceImplementation="com.intellij.platform.ProjectBaseDirectory"/>
<spellchecker.support language="JAVA" implementationClass="com.intellij.spellchecker.JavaSpellcheckingStrategy"/>
</extensions>
<actions>