diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java index 882f166e33dc..53f94d73bdaa 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/compiler/ArtifactCompileScope.java @@ -18,6 +18,7 @@ package com.intellij.packaging.impl.compiler; import com.intellij.compiler.impl.ModuleCompileScope; import com.intellij.openapi.compiler.CompileScope; import com.intellij.openapi.module.Module; +import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.packaging.artifacts.Artifact; @@ -28,9 +29,11 @@ import com.intellij.packaging.impl.elements.ModuleOutputElementType; import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; import com.intellij.util.Processor; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; /** * @author nik @@ -68,22 +71,33 @@ public class ArtifactCompileScope { return baseScope; } - @Nullable - public static Artifact[] getArtifacts(@NotNull CompileScope compileScope) { - return compileScope.getUserData(ARTIFACTS_KEY); - } - public static Set getArtifactsToBuild(final Project project, final CompileScope compileScope) { - final Artifact[] artifactsFromScope = getArtifacts(compileScope); + final Artifact[] artifactsFromScope = compileScope.getUserData(ARTIFACTS_KEY); if (artifactsFromScope != null) { return new HashSet(Arrays.asList(artifactsFromScope)); } Set artifacts = new HashSet(); - for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) { + final ArtifactManager artifactManager = ArtifactManager.getInstance(project); + final Set modules = new HashSet(Arrays.asList(compileScope.getAffectedModules())); + for (Artifact artifact : artifactManager.getArtifacts()) { if (artifact.isBuildOnMake()) { - artifacts.add(artifact); + if (modules.containsAll(Arrays.asList(ModuleManager.getInstance(project).getModules())) + || containsModuleOutput(artifact, modules, artifactManager)) { + artifacts.add(artifact); + } } } return artifacts; } + + private static boolean containsModuleOutput(Artifact artifact, final Set modules, ArtifactManager artifactManager) { + final PackagingElementResolvingContext context = artifactManager.getResolvingContext(); + return !ArtifactUtil.processPackagingElements(artifact, ModuleOutputElementType.MODULE_OUTPUT_ELEMENT_TYPE, + new Processor() { + public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) { + final Module module = moduleOutputPackagingElement.findModule(context); + return module == null || !modules.contains(module); + } + }, context, true); + } } diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java index 732a558b08c7..342e7da61776 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java @@ -41,7 +41,8 @@ public class StringLiteralManipulator extends AbstractElementManipulatorVcs.MessageActionGroup action group. * @@ -43,11 +43,14 @@ public class ShowMessageHistoryAction extends AnAction implements DumbAware { public void update(AnActionEvent e) { super.update(e); - CheckinProjectPanel panel = (CheckinProjectPanel)e.getDataContext().getData(CheckinProjectPanel.PANEL); + + final CheckinProjectPanel panel = (CheckinProjectPanel)CheckinProjectPanel.PANEL_KEY.getData(e.getDataContext()); + if (panel == null) { e.getPresentation().setVisible(false); e.getPresentation().setEnabled(false); - } else { + } + else { e.getPresentation().setVisible(true); final ArrayList recentMessages = VcsConfiguration.getInstance(panel.getProject()).getRecentMessages(); e.getPresentation().setEnabled(!recentMessages.isEmpty()); @@ -55,37 +58,42 @@ public class ShowMessageHistoryAction extends AnAction implements DumbAware { } public void actionPerformed(AnActionEvent e) { - CheckinProjectPanel panel = (CheckinProjectPanel)e.getDataContext().getData(CheckinProjectPanel.PANEL); + final CheckinProjectPanel panel = (CheckinProjectPanel)CheckinProjectPanel.PANEL_KEY.getData(e.getDataContext()); + if (panel != null) { final Project project = panel.getProject(); final VcsConfiguration configuration = VcsConfiguration.getInstance(project); - final ArrayList recentMessages = configuration.getRecentMessages(); - Collections.reverse(recentMessages); - if (!recentMessages.isEmpty()) { + if (!configuration.getRecentMessages().isEmpty()) { - final ContentChooser contentChooser = new ContentChooser(project, VcsBundle.message("dialog.title.choose.commit.message.from.history"), false){ - protected void removeContentAt(final String content) { - } + final ContentChooser contentChooser = + new ContentChooser(project, VcsBundle.message("dialog.title.choose.commit.message.from.history"), false) { + protected void removeContentAt(final String content) { + configuration.removeMessage(content); + } - protected String getStringRepresentationFor(final String content) { - return content; - } + protected String getStringRepresentationFor(final String content) { + return content; + } + + protected List getContents() { + final List recentMessages = configuration.getRecentMessages(); + Collections.reverse(recentMessages); + return recentMessages; + } + }; - protected List getContents() { - return recentMessages; - } - }; contentChooser.show(); + if (contentChooser.isOK()) { final int selectedIndex = contentChooser.getSelectedIndex(); + if (selectedIndex >= 0) { panel.setCommitMessage(contentChooser.getAllContents().get(selectedIndex)); } } } - } } } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/Refreshable.java b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/Refreshable.java index 9d0e351aa08b..cb0b9d424295 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/ui/Refreshable.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/ui/Refreshable.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.vcs.ui; -import org.jetbrains.annotations.NonNls; import com.intellij.openapi.actionSystem.DataKey; /** @@ -25,17 +24,19 @@ import com.intellij.openapi.actionSystem.DataKey; * @author lesya */ public interface Refreshable { + DataKey PANEL_KEY = DataKey.create("Panel"); + /** * The data ID which can be used to retrieve the active Refreshable * instance from {@link com.intellij.openapi.actionSystem.DataContext}. * * @see com.intellij.openapi.actionSystem.DataContext#getData(String) */ - @NonNls @Deprecated String PANEL = "Panel"; - DataKey PANEL_KEY = DataKey.create(PANEL); + @Deprecated String PANEL = PANEL_KEY.getName(); void refresh(); void saveState(); + void restoreState(); } diff --git a/plugins/git4idea/src/git4idea/vfs/GitRootTracker.java b/plugins/git4idea/src/git4idea/vfs/GitRootTracker.java index 58f1c250a4b7..b65796f03a31 100644 --- a/plugins/git4idea/src/git4idea/vfs/GitRootTracker.java +++ b/plugins/git4idea/src/git4idea/vfs/GitRootTracker.java @@ -262,11 +262,7 @@ public class GitRootTracker implements VcsListener { if (!hasInvalidRoots) { // check if roots have a problem for (final VirtualFile root : rootSet) { - hasInvalidRoots = ApplicationManager.getApplication().runReadAction(new Computable() { - public Boolean compute() { - return hasUnmappedSubroots(root, rootSet); - } - }); + hasInvalidRoots = hasUnmappedSubroots(root, rootSet); if (hasInvalidRoots) { break; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java index 50404374b848..c48319cb8625 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/DeleteOptionsDialog.java @@ -89,11 +89,10 @@ public class DeleteOptionsDialog extends DialogWrapper { panel.add(new JLabel("Recent Messages: "), gc); gc.gridy += 1; - ArrayList messages = VcsConfiguration.getInstance(myProject).getRecentMessages(); - if (messages != null) { - Collections.reverse(messages); - } - Object[] model = messages != null ? messages.toArray() : new Object[] {""}; + final ArrayList messages = VcsConfiguration.getInstance(myProject).getRecentMessages(); + Collections.reverse(messages); + + final String[] model = messages.toArray(new String[messages.size()]); final JComboBox messagesBox = new JComboBox(model); messagesBox.setRenderer(new MessageBoxCellRenderer()); panel.add(messagesBox, gc); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java index 6dfec8a727e5..d16e78bb0d3e 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/ImportOptionsDialog.java @@ -26,8 +26,8 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.svn.DepthCombo; import org.jetbrains.idea.svn.SvnBundle; -import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.SVNDepth; +import org.tmatesoft.svn.core.SVNURL; import javax.swing.*; import java.awt.*; @@ -127,7 +127,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener final JLabel depthLabel = new JLabel(SvnBundle.message("label.depth.text")); depthLabel.setToolTipText(SvnBundle.message("label.depth.description")); panel.add(depthLabel, gc); - ++ gc.gridx; + ++gc.gridx; myDepth = new DepthCombo(); panel.add(myDepth, gc); depthLabel.setLabelFor(myDepth); @@ -162,11 +162,10 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener panel.add(new JLabel("Recent Messages: "), gc); gc.gridy += 1; - ArrayList messages = VcsConfiguration.getInstance(myProject).getRecentMessages(); - if (messages != null) { - Collections.reverse(messages); - } - Object[] model = messages != null ? messages.toArray() : new Object[] {""}; + final ArrayList messages = VcsConfiguration.getInstance(myProject).getRecentMessages(); + Collections.reverse(messages); + + final String[] model = messages.toArray(new String[messages.size()]); final JComboBox messagesBox = new JComboBox(model); messagesBox.setRenderer(new MessageBoxCellRenderer()); panel.add(messagesBox, gc); @@ -199,7 +198,7 @@ public class ImportOptionsDialog extends DialogWrapper implements ActionListener fcd.setDescription("Select directory to checkout from subversion"); fcd.setHideIgnored(false); VirtualFile[] files = FileChooser.chooseFiles(getContentPane(), fcd, null); - if (files == null || files.length != 1 || files[0] == null) { + if (files.length != 1 || files[0] == null) { return; } myPathField.setText(files[0].getPath().replace('/', File.separatorChar)); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java index adc06381e4ef..5f69a79898f1 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/dialogs/browser/MkdirOptionsDialog.java @@ -47,8 +47,8 @@ public class MkdirOptionsDialog extends DialogWrapper { myOriginalURL = url; try { myURL = url.appendPath("NewFolder", true); - } catch (SVNException e) { - // + } + catch (SVNException ignore) { } setTitle("New Remote Folder"); init(); @@ -61,9 +61,10 @@ public class MkdirOptionsDialog extends DialogWrapper { }); if (!project.isDefault()) { - ArrayList messages = VcsConfiguration.getInstance(project).getRecentMessages(); + final ArrayList messages = VcsConfiguration.getInstance(project).getRecentMessages(); Collections.reverse(messages); - Object[] model = messages.toArray(); + + final String[] model = messages.toArray(new String[messages.size()]); myMessagesBox.setModel(new DefaultComboBoxModel(model)); myMessagesBox.setRenderer(new MessageBoxCellRenderer()); } @@ -98,8 +99,8 @@ public class MkdirOptionsDialog extends DialogWrapper { if (getOKAction().isEnabled()) { try { return SVNURL.parseURIEncoded(myURLLabel.getText()); - } catch (SVNException e) { - // + } + catch (SVNException ignore) { } } return null; @@ -128,7 +129,8 @@ public class MkdirOptionsDialog extends DialogWrapper { try { myURLLabel.setText(myOriginalURL.appendPath(newName, false).toString()); getOKAction().setEnabled(true); - } catch (SVNException e) { + } + catch (SVNException e) { myURLLabel.setText(myOriginalURL.toString()); getOKAction().setEnabled(false); }