Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Kirill Kalishev
2010-11-16 17:32:08 +03:00
21 changed files with 335 additions and 76 deletions
@@ -15,6 +15,9 @@
*/
package com.intellij.openapi.roots.ui.configuration.classpath;
import com.intellij.openapi.ui.popup.PopupStep;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
/**
@@ -32,6 +35,15 @@ abstract class AddItemPopupAction<ItemType> extends ChooseAndAddAction<ItemType>
myIndex = index;
}
public boolean hasSubStep() {
return false;
}
@Nullable
public PopupStep createSubStep() {
return null;
}
public String getTitle() {
return myTitle;
}
@@ -23,8 +23,10 @@ import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryEditingUtil;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesModifiableModel;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.util.Icons;
import com.intellij.util.ui.classpath.ChooseLibrariesFromTablesDialog;
import org.jetbrains.annotations.Nullable;
@@ -36,13 +38,21 @@ import java.util.List;
*/
class AddLibraryAction extends AddItemPopupAction<Library> {
private StructureConfigurableContext myContext;
private AddNewLibraryItemAction myNewLibraryAction;
public AddLibraryAction(ClasspathPanel classpathPanel, final int index, final String title,
final StructureConfigurableContext context) {
super(classpathPanel, index, title, Icons.LIBRARY_ICON);
myContext = context;
myNewLibraryAction = new AddNewLibraryItemAction(classpathPanel, context);
}
@Override
public boolean hasSubStep() {
return !hasLibraries() && AddNewLibraryItemAction.hasSuitableTypes(myClasspathPanel);
}
@Override
public PopupStep createSubStep() {
return AddNewLibraryItemAction.createChooseTypeStep(myClasspathPanel, myContext, null);
}
@Override
@@ -51,16 +61,19 @@ class AddLibraryAction extends AddItemPopupAction<Library> {
super.run();
}
else {
myNewLibraryAction.run();
new AddNewLibraryItemAction(myClasspathPanel, myContext, null).run();
}
}
private boolean hasLibraries() {
final Predicate<Library> condition = LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel());
for (LibraryTable table : ChooseLibrariesFromTablesDialog.getLibraryTables(myClasspathPanel.getProject(), true)) {
for (Library library : table.getLibraries()) {
if (condition.apply(library)) {
return true;
final LibrariesModifiableModel model = myContext.myLevel2Providers.get(table.getTableLevel());
if (model != null) {
for (Library library : model.getLibraries()) {
if (condition.apply(library)) {
return true;
}
}
}
}
@@ -101,8 +114,8 @@ class AddLibraryAction extends AddItemPopupAction<Library> {
public void doChoose() {
final Predicate<Library> condition = LibraryEditingUtil.getNotAddedLibrariesCondition(myClasspathPanel.getRootModel());
ProjectStructureChooseLibrariesDialog dialog = new ProjectStructureChooseLibrariesDialog(myClasspathPanel.getComponent(), myClasspathPanel.getProject(), myContext,
condition, myNewLibraryAction);
ProjectStructureChooseLibrariesDialog dialog = new ProjectStructureChooseLibrariesDialog(myClasspathPanel, myContext,
condition);
dialog.show();
mySelectedLibraries = dialog.getSelectedLibraries();
}
@@ -15,21 +15,37 @@
*/
package com.intellij.openapi.roots.ui.configuration.classpath;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryType;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.util.Icons;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
*/
class AddNewLibraryItemAction extends ChooseAndAddAction<Library> {
private final StructureConfigurableContext myContext;
private LibraryType myLibraryType;
public AddNewLibraryItemAction(final ClasspathPanel classpathPanel,
StructureConfigurableContext context) {
StructureConfigurableContext context, LibraryType libraryType) {
super(classpathPanel);
myContext = context;
myLibraryType = libraryType;
}
protected ClasspathTableItem<?> createTableItem(final Library item) {
@@ -46,6 +62,64 @@ class AddNewLibraryItemAction extends ChooseAndAddAction<Library> {
}
protected ClasspathElementChooser<Library> createChooser() {
return new NewLibraryChooser(myClasspathPanel.getProject(), myClasspathPanel.getRootModel(), myContext, myClasspathPanel.getComponent());
return new NewLibraryChooser(myClasspathPanel.getProject(), myClasspathPanel.getRootModel(), myLibraryType, myContext, myClasspathPanel.getComponent());
}
public static void chooseTypeAndExecute(final ClasspathPanel classpathPanel,
final StructureConfigurableContext context,
final DialogWrapper parentDialog,
JButton contextButton) {
if (hasSuitableTypes(classpathPanel)) {
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(createChooseTypeStep(classpathPanel, context, parentDialog));
popup.showUnderneathOf(contextButton);
}
else {
if (parentDialog != null) parentDialog.close(DialogWrapper.CANCEL_EXIT_CODE);
new AddNewLibraryItemAction(classpathPanel, context, null).execute();
}
}
public static BaseListPopupStep<LibraryType> createChooseTypeStep(final ClasspathPanel classpathPanel,
final StructureConfigurableContext context,
final DialogWrapper parentDialog) {
return new BaseListPopupStep<LibraryType>("Select Library Type", getSuitableTypes(classpathPanel)) {
@NotNull
@Override
public String getTextFor(LibraryType value) {
return value != null ? value.getCreateActionName() : IdeBundle.message("create.default.library.type.action.name");
}
@Override
public Icon getIconFor(LibraryType aValue) {
return aValue != null ? aValue.getIcon() : Icons.LIBRARY_ICON;
}
@Override
public PopupStep onChosen(final LibraryType selectedValue, boolean finalChoice) {
return doFinalStep(new Runnable() {
@Override
public void run() {
if (parentDialog != null) parentDialog.close(DialogWrapper.CANCEL_EXIT_CODE);
new AddNewLibraryItemAction(classpathPanel, context, selectedValue).execute();
}
});
}
};
}
public static boolean hasSuitableTypes(ClasspathPanel panel) {
return getSuitableTypes(panel).size() > 1;
}
private static List<LibraryType> getSuitableTypes(ClasspathPanel classpathPanel) {
List<LibraryType> suitableTypes = new ArrayList<LibraryType>();
suitableTypes.add(null);
final ModuleType moduleType = classpathPanel.getRootModel().getModule().getModuleType();
for (LibraryType libraryType : LibraryType.EP_NAME.getExtensions()) {
if (libraryType.isSuitableModuleType(moduleType)) {
suitableTypes.add(libraryType);
}
}
return suitableTypes;
}
}
@@ -312,10 +312,18 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
return aValue.getIcon();
}
@Override
public boolean hasSubstep(AddItemPopupAction<?> selectedValue) {
return selectedValue.hasSubStep();
}
public boolean isMnemonicsNavigationEnabled() {
return true;
}
public PopupStep onChosen(final AddItemPopupAction<?> selectedValue, final boolean finalChoice) {
if (selectedValue.hasSubStep()) {
return selectedValue.createSubStep();
}
return doFinalStep(new Runnable() {
public void run() {
selectedValue.execute();
@@ -23,6 +23,7 @@ import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
import com.intellij.openapi.roots.libraries.LibraryType;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.CreateNewLibraryDialog;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
@@ -42,11 +43,13 @@ class NewLibraryChooser implements ClasspathElementChooser<Library> {
private StructureConfigurableContext myContext;
private final JComponent myParentComponent;
private final Project myProject;
private LibraryType myLibraryType;
public NewLibraryChooser(final Project project,
final ModifiableRootModel rootModel,
StructureConfigurableContext context, final JComponent parentComponent) {
final ModifiableRootModel rootModel,
LibraryType libraryType, StructureConfigurableContext context, final JComponent parentComponent) {
myRootModel = rootModel;
myLibraryType = libraryType;
myContext = context;
myParentComponent = parentComponent;
myProject = project;
@@ -57,11 +60,20 @@ class NewLibraryChooser implements ClasspathElementChooser<Library> {
}
public void doChoose() {
final NewLibraryEditor libraryEditor;
if (myLibraryType == null) {
libraryEditor = new NewLibraryEditor();
}
else {
libraryEditor = new NewLibraryEditor(myLibraryType, myLibraryType.createDefaultProperties());
}
final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
List<LibraryTable> tables = Arrays.asList(myRootModel.getModuleLibraryTable(),
registrar.getLibraryTable(myProject),
registrar.getLibraryTable());
CreateNewLibraryDialog dialog = new CreateNewLibraryDialog(myParentComponent, myContext, new NewLibraryEditor(), tables, 1);
CreateNewLibraryDialog dialog = new CreateNewLibraryDialog(myParentComponent, myContext, libraryEditor, tables, 1);
final Module contextModule = DataKeys.MODULE_CONTEXT.getData(DataManager.getInstance().getDataContext(myParentComponent));
dialog.setContextModule(contextModule);
dialog.show();
@@ -27,7 +27,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigur
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.ui.classpath.ChooseLibrariesFromTablesDialog;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.ActionEvent;
@@ -37,18 +36,18 @@ import java.awt.event.KeyEvent;
* @author nik
*/
public class ProjectStructureChooseLibrariesDialog extends ChooseLibrariesFromTablesDialog {
private final ClasspathPanel myClasspathPanel;
private StructureConfigurableContext myContext;
private Predicate<Library> myAcceptedLibraries;
private AddNewLibraryItemAction myNewLibraryAction;
private JButton myCreateLibraryButton;
public ProjectStructureChooseLibrariesDialog(JComponent parentComponent,
@Nullable Project project,
public ProjectStructureChooseLibrariesDialog(ClasspathPanel classpathPanel,
StructureConfigurableContext context,
Predicate<Library> acceptedLibraries, AddNewLibraryItemAction newLibraryAction) {
super(parentComponent, "Choose Libraries", project, true);
Predicate<Library> acceptedLibraries) {
super(classpathPanel.getComponent(), "Choose Libraries", classpathPanel.getProject(), true);
myClasspathPanel = classpathPanel;
myContext = context;
myAcceptedLibraries = acceptedLibraries;
myNewLibraryAction = newLibraryAction;
setOKButtonText("Add Selected");
init();
}
@@ -95,6 +94,15 @@ public class ProjectStructureChooseLibrariesDialog extends ChooseLibrariesFromTa
return new Action[]{getOKAction(), new CreateNewLibraryAction()};
}
@Override
protected JButton createJButtonForAction(Action action) {
final JButton button = super.createJButtonForAction(action);
if (action instanceof CreateNewLibraryAction) {
myCreateLibraryButton = button;
}
return button;
}
@Override
protected LibrariesTreeNodeBase<Library> createLibraryDescriptor(NodeDescriptor parentDescriptor,
Library library) {
@@ -121,8 +129,7 @@ public class ProjectStructureChooseLibrariesDialog extends ChooseLibrariesFromTa
@Override
protected void doAction(ActionEvent e) {
close(CANCEL_EXIT_CODE);
myNewLibraryAction.execute();
AddNewLibraryItemAction.chooseTypeAndExecute(myClasspathPanel, myContext, ProjectStructureChooseLibrariesDialog.this, myCreateLibraryButton);
}
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
@@ -30,7 +31,6 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesModifiab
import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
import com.intellij.openapi.ui.MasterDetailsComponent;
import com.intellij.util.Icons;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -78,7 +78,11 @@ public class CreateNewLibraryAction extends AnAction {
private void appendLibraryToModules(final ModuleStructureConfigurable rootConfigurable, final Library libraryToSelect) {
final List<Module> modules = new ArrayList<Module>();
ContainerUtil.addAll(modules, rootConfigurable.getModules());
for (Module module : rootConfigurable.getModules()) {
if (myType == null || myType.isSuitableModuleType(module.getModuleType())) {
modules.add(module);
}
}
if (modules.isEmpty()) return;
final ChooseModulesDialog dlg = new ChooseModulesDialog(myProject,
modules, ProjectBundle.message("choose.modules.dialog.title"),
@@ -99,7 +103,7 @@ public class CreateNewLibraryAction extends AnAction {
return new AnAction[]{new CreateNewLibraryAction(text, Icons.LIBRARY_ICON, null, librariesConfigurable, project)};
}
List<AnAction> actions = new ArrayList<AnAction>();
actions.add(new CreateNewLibraryAction("Java", Icons.LIBRARY_ICON, null, librariesConfigurable, project));
actions.add(new CreateNewLibraryAction(IdeBundle.message("create.default.library.type.action.name"), Icons.LIBRARY_ICON, null, librariesConfigurable, project));
for (LibraryType<?> type : extensions) {
actions.add(new CreateNewLibraryAction(type.getCreateActionName(), type.getIcon(), type, librariesConfigurable, project));
}
@@ -17,6 +17,7 @@ package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
@@ -67,8 +68,8 @@ public class CreateNewLibraryDialog extends LibraryEditorDialogBase {
}
public Library createLibrary() {
final LibraryTable.ModifiableModel modifiableModel = getTableModifiableModel();
final Library library = modifiableModel.createLibrary(myLibraryEditor.getName());
final LibraryTableBase.ModifiableModelEx modifiableModel = (LibraryTableBase.ModifiableModelEx)getTableModifiableModel();
final Library library = modifiableModel.createLibrary(myLibraryEditor.getName(), myLibraryEditor.getType());
final Library.ModifiableModel model = library.getModifiableModel();
myLibraryEditor.apply(model);
new WriteAction() {
@@ -16,6 +16,7 @@
package com.intellij.openapi.roots.libraries;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.roots.libraries.ui.LibraryEditorComponent;
import com.intellij.openapi.roots.libraries.ui.LibraryPropertiesEditor;
import com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor;
@@ -50,6 +51,13 @@ public abstract class LibraryType<P extends LibraryProperties> extends LibraryPr
@NotNull
public abstract P createDefaultProperties();
/**
* @return {@code true} if library of this type can be added as a dependency to a module of type {@code moduleType}
*/
public boolean isSuitableModuleType(@NotNull ModuleType moduleType) {
return true;
}
/**
* Override this method to customize the library roots editor
* @return {@link com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor} instance
@@ -92,6 +92,7 @@ public class VfsUtil {
* @param separator character to use as files separator
* @return the relative path
*/
@Nullable
public static String getRelativePath(@NotNull VirtualFile file, @NotNull VirtualFile ancestor, char separator) {
if (!file.getFileSystem().equals(ancestor.getFileSystem())) return null;
@@ -984,6 +984,9 @@ setup.library.dialog.title=Setup Library
label.library.will.be.created.description.text={0} level library <b>{1}</b> with {2} file(s) will be created
new.library.file.chooser.title=New Library Files
new.library.file.chooser.description=Select jar files in which library classes are located
create.default.library.type.action.name=Java
file.chooser.show.path=Show path
file.chooser.hide.path=Hide path
file.chooser.hide.path.tooltip.text=Show/Hide path text field
@@ -225,12 +225,12 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
Annotation annotation = myHolder.createInfoAnnotation(elt, null);
final GrExpression qualifier = referenceExpression.getQualifierExpression();
if (qualifier == null) {
if (!(parent instanceof GrCall)) {
registerCreateClassByTypeFix(referenceExpression, annotation);
registerAddImportFixes(referenceExpression, annotation);
if (parent instanceof GrMethodCall) {
registerStaticImportFix(referenceExpression, annotation);
}
else {
registerStaticImportFix(referenceExpression, annotation);
registerCreateClassByTypeFix(referenceExpression, annotation);
registerAddImportFixes(referenceExpression, annotation);
}
}
else {
@@ -380,7 +380,9 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
PsiElement typeDef = parent.getParent();
if (typeDef != null && typeDef instanceof GrTypeDefinition) {
PsiModifierList modifiersList = variableDeclaration.getModifierList();
final GrMember member = variableDeclaration.getMembers()[0];
final GrMember[] members = variableDeclaration.getMembers();
if (members.length == 0) return;
final GrMember member = members[0];
checkAccessModifiers(myHolder, modifiersList, member);
checkDuplicateModifiers(myHolder, variableDeclaration.getModifierList(), member);
@@ -17,8 +17,10 @@ package org.jetbrains.plugins.groovy.codeInspection.unusedDef;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import com.intellij.psi.impl.DebugUtil;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.searches.ReferencesSearch;
import com.intellij.psi.util.PsiTreeUtil;
@@ -56,6 +58,8 @@ import java.util.ArrayList;
& @author ven
*/
public class UnusedDefInspection extends GroovyLocalInspectionBase {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.plugins.groovy.codeInspection.unusedDef.UnusedDefInspection");
@Nls
@NotNull
public String getGroupDisplayName() {
@@ -152,7 +156,7 @@ public class UnusedDefInspection extends GroovyLocalInspectionBase {
if (var != null) {
final GroovyPsiElement scope = getScope(var);
assert scope != null;
LOG.assertTrue(scope != null, DebugUtil.psiToString(var.getContainingFile(), true, false));
return ReferencesSearch.search(var, new LocalSearchScope(scope)).forEach(new Processor<PsiReference>() {
public boolean process(PsiReference ref) {
@@ -49,20 +49,19 @@ public class GppClosureParameterTypeProvider extends AbstractClosureParameterEnh
assert argIndex >= 0;
if (listType instanceof GrTupleType) {
for (PsiType type : GroovyExpectedTypesProvider.getDefaultExpectedTypes(list)) {
if (type instanceof PsiClassType) {
for (GroovyResolveResult resolveResult : PsiUtil
.getConstructorCandidates((PsiClassType)type, ((GrTupleType)listType).getComponentTypes(), closure)) {
final PsiElement method = resolveResult.getElement();
if (method instanceof PsiMethod && ((PsiMethod)method).isConstructor()) {
final PsiType toCastTo =
resolveResult.getSubstitutor().substitute(((PsiMethod)method).getParameterList().getParameters()[argIndex].getType());
final PsiType suggestion = getSingleMethodParameterType(toCastTo, index, closure);
if (suggestion != null) {
return suggestion;
}
}
if (!(type instanceof PsiClassType)) continue;
}
final GroovyResolveResult[] candidates = PsiUtil.getConstructorCandidates((PsiClassType)type,((GrTupleType)listType).getComponentTypes(),closure);
for (GroovyResolveResult resolveResult : candidates) {
final PsiElement method = resolveResult.getElement();
if (!(method instanceof PsiMethod) || !((PsiMethod)method).isConstructor()) continue;
final PsiParameter[] parameters = ((PsiMethod)method).getParameterList().getParameters();
if (parameters.length <= argIndex) continue;
final PsiType toCastTo = resolveResult.getSubstitutor().substitute(parameters[argIndex].getType());
final PsiType suggestion = getSingleMethodParameterType(toCastTo, index, closure);
if (suggestion != null) return suggestion;
}
}
}
@@ -15,5 +15,5 @@ class A{
}
}
-----
Introduced variable will conflict with local variable preved
Introduced variable will conflict with parameter preved
Introduced variable will conflict with local variable preved
@@ -172,7 +172,19 @@ public class CustomArtifact implements Artifact {
}
public String getId() {
return myWrapee.getId();
try {
return myWrapee.getId();
}
catch (NullPointerException e) {
if (e.getMessage() != null && e.getMessage().contains("version was null")) {
VersionRange range = getVersionRange();
if (range != null) {
setBaseVersion(range.toString());
return myWrapee.getId();
}
}
throw e;
}
}
public String getDependencyConflictId() {
@@ -56,7 +56,7 @@ public abstract class RemoteObjectWrapper<T> {
}
protected synchronized void handleRemoteError(RemoteException e) {
MavenLog.LOG.info("Connection failed. Will be reconnected on the next request.", e);
MavenLog.LOG.debug("Connection failed. Will be reconnected on the next request.", e);
onError();
}
@@ -40,7 +40,7 @@ public class MavenConsoleImpl extends MavenConsole {
private static final Key<MavenConsoleImpl> CONSOLE_KEY = Key.create("MAVEN_CONSOLE_KEY");
private static final String CONSOLE_FILTER_REGEXP =
RegexpFilter.FILE_PATH_MACROS + ":\\[" + RegexpFilter.LINE_MACROS + "," + RegexpFilter.COLUMN_MACROS + "]";
"(?:^|(?:\\[\\w+\\]\\s*))" + RegexpFilter.FILE_PATH_MACROS + ":\\[" + RegexpFilter.LINE_MACROS + "," + RegexpFilter.COLUMN_MACROS + "]";
private final String myTitle;
private final Project myProject;
@@ -153,9 +153,9 @@ public class MavenConsoleImpl extends MavenConsole {
}
ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
if (!toolWindow.isActive()) {
if (!toolWindow.isActive()) {
toolWindow.activate(null, false);
}
}
}
});
}
@@ -343,18 +343,20 @@ public class MavenProjectsManager extends SimpleProjectComponent
@Override
public void projectResolved(Pair<MavenProject, MavenProjectChanges> projectWithChanges,
@Nullable NativeMavenProjectHolder nativeMavenProject) {
if (nativeMavenProject != null && shouldScheduleProject(projectWithChanges)) {
scheduleForNextImport(projectWithChanges);
if (nativeMavenProject != null) {
if (shouldScheduleProject(projectWithChanges)) {
scheduleForNextImport(projectWithChanges);
if (projectWithChanges.first.hasUnresolvedPlugins()) {
schedulePluginsResolve(projectWithChanges.first, nativeMavenProject);
scheduleArtifactsDownloading(Collections.singleton(projectWithChanges.first),
null,
getImportingSettings().isDownloadSourcesAutomatically(),
getImportingSettings().isDownloadDocsAutomatically(),
null);
}
scheduleArtifactsDownloading(Collections.singleton(projectWithChanges.first),
null,
getImportingSettings().isDownloadSourcesAutomatically(),
getImportingSettings().isDownloadDocsAutomatically(),
null);
if (!projectWithChanges.first.hasReadingProblems() && projectWithChanges.first.hasUnresolvedPlugins()) {
schedulePluginsResolve(projectWithChanges.first, nativeMavenProject);
}
}
}
@@ -1640,7 +1640,7 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
public void testCustomSourcesAndJavadocPaths() throws Exception {
if (!checkUltimate()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>" +
@@ -2041,4 +2041,101 @@ public class DependenciesImportingTest extends MavenImportingTestCase {
assertModuleLibDep("project", "Maven: junit:junit:3.8.2",
"jar://" + repoPath + "/junit/junit/3.8.2/junit-3.8.2.jar!/");
}
//public void testVersionRangeDoesntBreakIndirectDependency() throws Exception {
// createProjectPom("<groupId>test</groupId>" +
// "<artifactId>project</artifactId>" +
// "<version>1</version>" +
// "<packaging>pom</packaging>" +
//
// "<modules>" +
// " <module>m1</module>" +
// " <module>m2</module>" +
// "</modules>");
//
// createModulePom("m1", "<groupId>test</groupId>" +
// "<artifactId>m1</artifactId>" +
// "<version>1</version>" +
//
// "<dependencies>" +
// " <dependency>" +
// " <groupId>asm</groupId>" +
// " <artifactId>asm</artifactId>" +
// " <version>2.2.3</version>" +
// " </dependency>" +
// "</dependencies>");
//
// createModulePom("m2", "<groupId>test</groupId>" +
// "<artifactId>m2</artifactId>" +
// "<version>1</version>" +
//
// "<dependencies>" +
// " <dependency>" +
// " <groupId>test</groupId>" +
// " <artifactId>m1</artifactId>" +
// " <version>1</version>" +
// " </dependency>" +
// " <dependency>" +
// " <groupId>asm</groupId>" +
// " <artifactId>asm</artifactId>" +
// " <version>[2.2.3]</version>" +
// " </dependency>" +
// "</dependencies>");
//
// importProject();
//
// assertModuleModuleDeps("m2", "m1");
// assertModuleLibDeps("m1", "Maven: asm:asm:2.2.3");
// assertModuleLibDeps("m2", "Maven: asm:asm:2.2.3");
//}
//
public void testVersionRangeInDependencyManagementDoesntBreakIndirectDependency() throws Exception {
createProjectPom("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>" +
"<packaging>pom</packaging>" +
"<modules>" +
" <module>m</module>" +
"</modules>" +
" <dependencyManagement>\n" +
" <dependencies>\n" +
" <dependency>\n" +
" <artifactId>asm</artifactId>\n" +
" <groupId>asm</groupId>\n" +
" <version>[2.2.1]</version>\n" +
" <scope>runtime</scope>\n" +
" </dependency>\n" +
" <dependency>\n" +
" <artifactId>asm-attrs</artifactId>\n" +
" <groupId>asm</groupId>\n" +
" <version>[2.2.1]</version>\n" +
" <scope>runtime</scope>\n" +
" </dependency>\n" +
" </dependencies>\n" +
" </dependencyManagement>");
createModulePom("m", "<groupId>test</groupId>" +
"<artifactId>m</artifactId>" +
"<version>1</version>" +
"" +
" <parent>\n" +
" <groupId>test</groupId>\n" +
" <artifactId>project</artifactId>\n" +
" <version>1</version>\n" +
" </parent>" +
"<dependencies>" +
" <dependency>" +
" <artifactId>asm-attrs</artifactId>\n" +
" <groupId>asm</groupId>\n" +
" <scope>test</scope>" +
" </dependency>" +
"</dependencies>");
importProject();
assertModuleLibDeps("m", "Maven: asm:asm-attrs:2.2.1", "Maven: asm:asm:2.2.1");
}
}
@@ -74,7 +74,7 @@ public class DependenciesManagementTest extends MavenImportingTestCase {
public void testImportingNotInstalledDependencies() throws Exception {
if (ignore()) return;
setRepositoryPath(new File(myDir, "/repo").getPath());
updateSettingsXml("<localRepository>" + getRepositoryPath() + "</localRepository>");
@@ -144,20 +144,20 @@ public class DependenciesManagementTest extends MavenImportingTestCase {
updateSettingsXml("<localRepository>" + getRepositoryPath() + "</localRepository>");
VirtualFile parent = createModulePom("parent",
"<groupId>test</groupId>" +
"<artifactId>parent</artifactId>" +
"<packaging>pom</packaging>" +
"<version>1</version>" +
"<groupId>test</groupId>" +
"<artifactId>parent</artifactId>" +
"<packaging>pom</packaging>" +
"<version>1</version>" +
"<dependencyManagement>" +
" <dependencies>" +
" <dependency>" +
" <groupId>junit</groupId>" +
" <artifactId>junit</artifactId>" +
" <version>4.0</version>" +
" </dependency>" +
" </dependencies>" +
"</dependencyManagement>");
"<dependencyManagement>" +
" <dependencies>" +
" <dependency>" +
" <groupId>junit</groupId>" +
" <artifactId>junit</artifactId>" +
" <version>4.0</version>" +
" </dependency>" +
" </dependencies>" +
"</dependencyManagement>");
VirtualFile project = createModulePom("project",
"<groupId>test</groupId>" +