excludedScopeNames) {
for (final NamedScope scope : scopes) {
- group.add(new AnAction(scope.getName()) {
+ final String scopeName = scope.getName();
+ if (excludedScopeNames.contains(scopeName)) {
+ continue;
+ }
+ group.add(new AnAction(scopeName) {
@Override
public void actionPerformed(final AnActionEvent e) {
for (final Descriptor defaultDescriptor : defaultDescriptors) {
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java
new file mode 100644
index 000000000000..d1f77dd0625c
--- /dev/null
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ * 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.profile.codeInspection.ui;
+
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.DialogWrapper;
+import com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx;
+import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
+import com.intellij.ui.*;
+import com.intellij.ui.components.JBList;
+import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Dmitry Batkovich
+ */
+public class ScopesOrderDialog extends DialogWrapper {
+
+ private final JList myOptionsList = new JBList();
+
+ private final InspectionProfileImpl myInspectionProfile;
+ private final Project myProject;
+ private final JPanel myPanel;
+
+ public ScopesOrderDialog(final @NotNull Component parent,
+ final InspectionProfileImpl inspectionProfile,
+ final Project project) {
+ super(parent, true);
+ myInspectionProfile = inspectionProfile;
+ myProject = project;
+
+ final JPanel listPanel = ToolbarDecorator.createDecorator(myOptionsList).setMoveDownAction(new AnActionButtonRunnable() {
+ @Override
+ public void run(AnActionButton anActionButton) {
+ ListUtil.moveSelectedItemsDown(myOptionsList);
+ }
+ }).setMoveUpAction(new AnActionButtonRunnable() {
+ @Override
+ public void run(AnActionButton anActionButton) {
+ ListUtil.moveSelectedItemsUp(myOptionsList);
+ }
+ }).disableRemoveAction().disableAddAction().createPanel();
+ final JLabel descr = new JLabel("If file appears in two or more scopes, it will be" +
+ "inspected with settings of the topmost scope in list above.
" +
+ "Scope order is set globally for all inspections in the profile.
");
+ descr.setPreferredSize(new Dimension(300, 100));
+ UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, descr);
+ myPanel = new JPanel();
+ myPanel.setLayout(new BorderLayout());
+ myPanel.add(listPanel, BorderLayout.CENTER);
+ myPanel.add(descr, BorderLayout.SOUTH);
+ fillList();
+ init();
+ setTitle("Scopes Order");
+ }
+
+ private void fillList() {
+ DefaultListModel model = new DefaultListModel();
+ model.removeAllElements();
+
+ final List scopes = new ArrayList();
+ for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
+ for (final NamedScope scope : holder.getScopes()) {
+ scopes.add(scope.getName());
+ }
+ }
+ scopes.remove(CustomScopesProviderEx.getAllScope().getName());
+ Collections.sort(scopes, new ScopeOrderComparator(myInspectionProfile));
+ for (String scopeName : scopes) {
+ model.addElement(scopeName);
+ }
+ myOptionsList.setModel(model);
+ myOptionsList.setSelectedIndex(0);
+ }
+
+ @Nullable
+ @Override
+ protected JComponent createCenterPanel() {
+ return myPanel;
+ }
+
+ @Override
+ protected void doOKAction() {
+ final int size = myOptionsList.getModel().getSize();
+ final String[] newScopeOrder = new String[size];
+ for (int i = 0; i < size; i++) {
+ final String scopeName = (String) myOptionsList.getModel().getElementAt(i);
+ newScopeOrder[i] = scopeName;
+ }
+ if (!Arrays.equals(newScopeOrder, myInspectionProfile.getScopesOrder())) {
+ myInspectionProfile.setScopesOrder(newScopeOrder);
+ }
+ super.doOKAction();
+ }
+}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
index d1e7f00e96f0..1a4bf2d32346 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
@@ -132,6 +132,8 @@ public class SingleInspectionProfilePanel extends JPanel {
private Splitter myRightSplitter;
private Splitter myMainSplitter;
+ private String[] myInitialScopesOrder;
+
public SingleInspectionProfilePanel(@NotNull InspectionProjectProfileManager projectProfileManager,
@NotNull String inspectionProfileName,
@NotNull ModifiableModel profile) {
@@ -258,6 +260,7 @@ public class SingleInspectionProfilePanel extends JPanel {
if (!accept(state.getTool())) continue;
myInitialToolDescriptors.add(ToolDescriptors.fromScopeToolState(state, profile, project));
}
+ myInitialScopesOrder = mySelectedProfile.getScopesOrder();
}
protected boolean accept(InspectionToolWrapper entry) {
@@ -364,24 +367,6 @@ public class SingleInspectionProfilePanel extends JPanel {
actions.add(actionManager.createExpandAllAction(myTreeExpander, myTreeTable));
actions.add(actionManager.createCollapseAllAction(myTreeExpander, myTreeTable));
-
- actions.add(new AnAction(CommonBundle.message("button.reset.to.default"), CommonBundle.message("button.reset.to.default"),
- AllIcons.General.Reset) {
- {
- registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK)), myTreeTable);
- }
- @Override
- public void update(AnActionEvent e) {
- e.getPresentation().setEnabled(myRoot.isProperSetting());
- }
-
- @Override
- public void actionPerformed(AnActionEvent e) {
- mySelectedProfile.resetToBase(myProjectProfileManager.getProject());
- postProcessModification();
- }
- });
-
actions.add(new AnAction("Reset to Empty", "Reset to empty", AllIcons.Actions.Reset_to_empty){
@Override
@@ -396,18 +381,19 @@ public class SingleInspectionProfilePanel extends JPanel {
}
});
- actions.add(new ToggleAction("Lock Profile", "Lock profile", AllIcons.Nodes.Padlock) {
+ actions.add(new AdvancedSettingsAction(myProjectProfileManager.getProject(), myRoot) {
@Override
- public boolean isSelected(AnActionEvent e) {
- return mySelectedProfile != null && mySelectedProfile.isProfileLocked();
+ protected InspectionProfileImpl getInspectionProfile() {
+ return mySelectedProfile;
}
@Override
- public void setSelected(AnActionEvent e, boolean state) {
- mySelectedProfile.lockProfile(state);
+ protected void postProcessModification() {
+ SingleInspectionProfilePanel.this.postProcessModification();
}
});
+
final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actions, true);
actionToolbar.setTargetComponent(this);
return actionToolbar;
@@ -692,7 +678,8 @@ public class SingleInspectionProfilePanel extends JPanel {
if (path == null) return;
final List nodes = InspectionsAggregationUtil.getInspectionsNodes(paths);
if (!nodes.isEmpty()) {
- final InspectionConfigTreeNode singleNode = nodes.size() == 1 ? ContainerUtil.getFirstItem(nodes) : null;
+ final InspectionConfigTreeNode singleNode = paths.length == 1 && ((InspectionConfigTreeNode)paths[0].getLastPathComponent()).getDefaultDescriptor() != null
+ ? ContainerUtil.getFirstItem(nodes) : null;
if (singleNode != null && singleNode.getDefaultDescriptor().loadDescription() != null) {
// need this in order to correctly load plugin-supplied descriptions
final Descriptor defaultDescriptor = singleNode.getDefaultDescriptor();
@@ -755,7 +742,7 @@ public class SingleInspectionProfilePanel extends JPanel {
final HighlightDisplayKey key = node.getDefaultDescriptor().getKey();
final NamedScope scope = node.getDefaultDescriptor().getScope();
final boolean toUpdate = mySelectedProfile.getErrorLevel(key, scope, project) != level;
- mySelectedProfile.setErrorLevel(key, level, -1, project);
+ mySelectedProfile.setErrorLevel(key, level, null, project);
if (toUpdate) node.dropCache();
}
@@ -775,7 +762,13 @@ public class SingleInspectionProfilePanel extends JPanel {
public Descriptor fun(final InspectionConfigTreeNode node) {
return node.getDefaultDescriptor();
}
- }), mySelectedProfile, project) {
+ }), mySelectedProfile, project, null) {
+ @Override
+ protected void onScopesOrderChanged() {
+ myTreeTable.getTree().updateUI();
+ updateOptionsAndDescriptionPanel();
+ }
+
@Override
protected void onScopeAdded() {
updateOptionsAndDescriptionPanel();
@@ -813,12 +806,19 @@ public class SingleInspectionProfilePanel extends JPanel {
}
@Override
- protected void onChange() {
+ protected void onSettingsChanged() {
myTreeTable.getTree().updateUI();
}
@Override
protected void onScopeAdded() {
+ updateOptionsAndDescriptionPanel();
+ }
+
+ @Override
+ protected void onScopesOrderChanged() {
+ myTreeTable.getTree().updateUI();
+ updateOptionsAndDescriptionPanel();
}
@Override
@@ -830,7 +830,7 @@ public class SingleInspectionProfilePanel extends JPanel {
});
- final ToolbarDecorator wrappedTable = ToolbarDecorator.createDecorator(scopesAndScopesAndSeveritiesTable);
+ final ToolbarDecorator wrappedTable = ToolbarDecorator.createDecorator(scopesAndScopesAndSeveritiesTable).disableUpDownActions();
final JPanel panel = wrappedTable.createPanel();
panel.setMinimumSize(new Dimension(getMinimumSize().width, 3 * scopesAndScopesAndSeveritiesTable.getRowHeight()));
severityPanel.add(new JBLabel("Scopes & Severities"),
@@ -1003,6 +1003,7 @@ public class SingleInspectionProfilePanel extends JPanel {
if (mySelectedProfile.isChanged()) return true;
if (myShareProfile != (mySelectedProfile.getProfileManager() == myProjectProfileManager)) return true;
if (!Comparing.strEqual(myInitialProfile, mySelectedProfile.getName())) return true;
+ if (!Comparing.equal(myInitialScopesOrder, mySelectedProfile.getScopesOrder())) return true;
if (descriptorsAreChanged()) {
return true;
}
@@ -1113,10 +1114,6 @@ public class SingleInspectionProfilePanel extends JPanel {
return false;
}
- public Tree getTreeTable() {
- return myTreeTable.getTree();
- }
-
public boolean isProfileShared() {
return myShareProfile;
}
@@ -1178,7 +1175,7 @@ public class SingleInspectionProfilePanel extends JPanel {
final boolean showOptionsAndDescriptorPanels,
@NotNull HighlightDisplayLevel level) {
final HighlightDisplayKey key = child.getDefaultDescriptor().getKey();
- mySelectedProfile.setErrorLevel(key, level, -1, myProjectProfileManager.getProject());
+ mySelectedProfile.setErrorLevel(key, level, null, myProjectProfileManager.getProject());
child.dropCache();
if (showOptionsAndDescriptorPanels) {
updateOptionsAndDescriptionPanel(new TreePath(child.getPath()));
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java
index 966a456e1d38..5a7fe8ef84c6 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java
@@ -154,7 +154,7 @@ public class InspectionsConfigTreeTable extends TreeTable {
mySettings.getInspectionProfile().getNonDefaultTools(toolId, mySettings.getProject()));
}
}
- return sink.constructIcon();
+ return sink.constructIcon(mySettings.getInspectionProfile());
} else if (column == IS_ENABLED_COLUMN) {
return isEnabled(inspectionsKeys);
}
@@ -204,17 +204,17 @@ public class InspectionsConfigTreeTable extends TreeTable {
private static class MultiColoredHighlightSeverityIconSink {
- private final LinkedHashMap myScopeToAverageSeverityMap = new LinkedHashMap();
+ private final Map myScopeToAverageSeverityMap = new HashMap();
+ private String myDefaultScopeName;
private boolean myIsFirst = true;
- public Icon constructIcon() {
+ public Icon constructIcon(final InspectionProfileImpl inspectionProfile) {
if (myScopeToAverageSeverityMap.isEmpty()) {
return null;
}
- //TODO order scopes
return !allScopesHasMixedSeverity()
- ? new MultiScopeSeverityIcon(myScopeToAverageSeverityMap)
+ ? new MultiScopeSeverityIcon(myScopeToAverageSeverityMap, myDefaultScopeName, inspectionProfile)
: ScopesAndSeveritiesTable.MIXED_FAKE_LEVEL.getIcon();
}
@@ -229,6 +229,9 @@ public class InspectionsConfigTreeTable extends TreeTable {
public void put(final ScopeToolState defaultState, final Collection nonDefault) {
putOne(defaultState);
+ if (myDefaultScopeName == null) {
+ myDefaultScopeName = defaultState.getScopeName();
+ }
for (final ScopeToolState scopeToolState : nonDefault) {
putOne(scopeToolState);
}
@@ -237,7 +240,7 @@ public class InspectionsConfigTreeTable extends TreeTable {
}
}
- public void putOne(final ScopeToolState state) {
+ private void putOne(final ScopeToolState state) {
final Icon icon = state.getLevel().getIcon();
final String scopeName = state.getScopeName();
if (icon instanceof HighlightDisplayLevel.SingleColorIconWithMask) {
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java
index 6f093ca66349..099dbb622261 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/MultiScopeSeverityIcon.java
@@ -17,13 +17,15 @@ package com.intellij.profile.codeInspection.ui.inspectionsTree;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
+import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.profile.codeInspection.ui.ScopeOrderComparator;
import com.intellij.ui.JBColor;
import javax.swing.*;
import java.awt.*;
-import java.util.Collection;
-import java.util.LinkedHashMap;
+import java.util.*;
+import java.util.List;
/**
* @author Dmitry Batkovich
@@ -35,8 +37,17 @@ public class MultiScopeSeverityIcon implements Icon {
private final LinkedHashMap myScopeToAverageSeverityMap;
- public MultiScopeSeverityIcon(final LinkedHashMap scopeToAverageSeverityMap) {
- myScopeToAverageSeverityMap = scopeToAverageSeverityMap;
+ public MultiScopeSeverityIcon(final Map scopeToAverageSeverityMap,
+ final String defaultScopeName,
+ final InspectionProfileImpl inspectionProfile) {
+ final List sortedScopeNames = new ArrayList(scopeToAverageSeverityMap.keySet());
+ myScopeToAverageSeverityMap = new LinkedHashMap();
+ Collections.sort(sortedScopeNames, new ScopeOrderComparator(inspectionProfile));
+ sortedScopeNames.remove(defaultScopeName);
+ sortedScopeNames.add(defaultScopeName);
+ for (final String scopeName : sortedScopeNames) {
+ myScopeToAverageSeverityMap.put(scopeName, scopeToAverageSeverityMap.get(scopeName));
+ }
}
public LinkedHashMap getScopeToAverageSeverityMap() {
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java
index 05cb7ab193f5..68c7f20119bd 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/ScopesAndSeveritiesHintTable.java
@@ -19,10 +19,12 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
import com.intellij.ui.table.JBTable;
+import com.intellij.util.ui.UIUtil;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;
+import javax.swing.table.TableColumn;
import java.awt.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -38,9 +40,20 @@ public class ScopesAndSeveritiesHintTable extends JBTable {
public ScopesAndSeveritiesHintTable(final LinkedHashMap scopeToAverageSeverityMap) {
super(new MyModel(scopeToAverageSeverityMap));
- final DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer();
- cellRenderer.setOpaque(false);
- getColumnModel().getColumn(SCOPE_COLUMN).setCellRenderer(cellRenderer);
+ getColumnModel().getColumn(SCOPE_COLUMN).setCellRenderer(new DefaultTableCellRenderer() {
+ @Override
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row,
+ int column) {
+ super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+ setOpaque(false);
+ UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, this);
+ return this;
+ }
+ });
getColumnModel().getColumn(SEVERITY_COLUMN).setCellRenderer(new DefaultTableCellRenderer() {
@Override
@@ -55,6 +68,7 @@ public class ScopesAndSeveritiesHintTable extends JBTable {
setIcon(HighlightDisplayLevel.find(severity).getIcon());
setText(SingleInspectionProfilePanel.renderSeverity(severity));
setOpaque(false);
+ UIUtil.applyStyle(UIUtil.ComponentStyle.SMALL, this);
return this;
}
});
@@ -62,6 +76,16 @@ public class ScopesAndSeveritiesHintTable extends JBTable {
setRowSelectionAllowed(false);
setColumnSelectionAllowed(false);
setOpaque(false);
+
+ for (int i = 0; i < getColumnModel().getColumnCount(); i++) {
+ int w = 0;
+ final TableColumn column = getColumnModel().getColumn(i);
+ for (int j = 0; j < getModel().getRowCount(); j++) {
+ final Component component = prepareRenderer(column.getCellRenderer(), j, i);
+ w = Math.max(component.getPreferredSize().width, w);
+ }
+ column.setPreferredWidth(w);
+ }
}
private final static class MyModel extends AbstractTableModel {
@@ -96,7 +120,7 @@ public class ScopesAndSeveritiesHintTable extends JBTable {
@Override
public Object getValueAt(final int rowIndex, final int columnIndex) {
switch (columnIndex) {
- case SCOPE_COLUMN: return myScopes.get(rowIndex);
+ case SCOPE_COLUMN: return rowIndex < getRowCount() - 1 ? myScopes.get(rowIndex) : "Everywhere else";
case SEVERITY_COLUMN: return myScopeToAverageSeverityMap.get(myScopes.get(rowIndex));
default: throw new IllegalArgumentException();
}
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java
index ad7dc946fff8..b76e0929d646 100644
--- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java
+++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java
@@ -17,20 +17,30 @@ package com.intellij.profile.codeInspection.ui.table;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
+import com.intellij.codeInspection.ex.Descriptor;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.codeInspection.ex.ScopeToolState;
import com.intellij.icons.AllIcons;
+import com.intellij.ide.DataManager;
import com.intellij.lang.annotation.HighlightSeverity;
+import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.ui.popup.JBPopupFactory;
+import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.util.Comparing;
-import com.intellij.profile.codeInspection.ui.AddScopeUtil;
+import com.intellij.profile.codeInspection.ui.ScopeOrderComparator;
+import com.intellij.profile.codeInspection.ui.ScopesChooser;
import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTreeNode;
import com.intellij.psi.search.scope.packageSet.NamedScope;
+import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.table.JBTable;
import com.intellij.ui.treeStructure.treetable.TreeTable;
import com.intellij.util.ArrayUtil;
+import com.intellij.util.Function;
import com.intellij.util.SmartList;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.EditableModel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -41,8 +51,8 @@ import javax.swing.event.ListSelectionListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
+import java.awt.*;
+import java.util.*;
import java.util.List;
/**
@@ -94,6 +104,8 @@ public class ScopesAndSeveritiesTable extends JBTable {
setStriped(true);
setShowGrid(false);
+
+ ((MyTableModel)getModel()).setTable(this);
}
public abstract static class TableSettings {
@@ -148,11 +160,13 @@ public class ScopesAndSeveritiesTable extends JBTable {
protected abstract void onScopeAdded();
+ protected abstract void onScopesOrderChanged();
+
protected abstract void onScopeRemoved(final int scopesCount);
protected abstract void onScopeChosen(final @NotNull ScopeToolState scopeToolState);
- protected abstract void onChange();
+ protected abstract void onSettingsChanged();
}
@NotNull
@@ -177,7 +191,9 @@ public class ScopesAndSeveritiesTable extends JBTable {
private final Project myProject;
private final TableSettings myTableSettings;
private final List myKeys;
+ private final Comparator myScopeComparator;
+ private JTable myTable;
private String[] myScopeNames;
public MyTableModel(final TableSettings tableSettings) {
@@ -188,9 +204,14 @@ public class ScopesAndSeveritiesTable extends JBTable {
myKeyNames = tableSettings.getKeyNames();
myNodes = tableSettings.getNodes();
myTreeTable = tableSettings.getTreeTable();
+ myScopeComparator = new ScopeOrderComparator(myInspectionProfile);
refreshAggregatedScopes();
}
+ public void setTable(JTable table) {
+ myTable = table;
+ }
+
@Override
public boolean isCellEditable(final int rowIndex, final int columnIndex) {
return columnIndex != SCOPE_NAME_COLUMN;
@@ -235,7 +256,7 @@ public class ScopesAndSeveritiesTable extends JBTable {
case SCOPE_ENABLED_COLUMN:
return isEnabled(rowIndex);
case SCOPE_NAME_COLUMN:
- return getScope(rowIndex).getName();
+ return rowIndex == lastRowIndex() ? "Everywhere else" : getScope(rowIndex).getName();
case SEVERITY_COLUMN:
return getSeverity(rowIndex);
default:
@@ -314,6 +335,7 @@ public class ScopesAndSeveritiesTable extends JBTable {
}
}
myScopeNames = ArrayUtil.toStringArray(scopesNames);
+ Arrays.sort(myScopeNames, myScopeComparator);
}
private int lastRowIndex() {
@@ -331,8 +353,8 @@ public class ScopesAndSeveritiesTable extends JBTable {
LOG.error("no display level found for name " + ((HighlightSeverity)value).getName());
return;
}
- final int idx = rowIndex == lastRowIndex() ? -1 : rowIndex;
- myInspectionProfile.setErrorLevel(myKeys, level, idx, myProject);
+ final String scopeName = rowIndex == lastRowIndex() ? null : getScope(rowIndex).getName();
+ myInspectionProfile.setErrorLevel(myKeys, level, scopeName, myProject);
}
else if (columnIndex == SCOPE_ENABLED_COLUMN) {
final NamedScope scope = getScope(rowIndex);
@@ -354,7 +376,7 @@ public class ScopesAndSeveritiesTable extends JBTable {
}
}
}
- myTableSettings.onChange();
+ myTableSettings.onSettingsChanged();
}
@Override
@@ -368,9 +390,31 @@ public class ScopesAndSeveritiesTable extends JBTable {
@Override
public void addRow() {
- AddScopeUtil.performAddScope(myTreeTable, myProject, myInspectionProfile, myNodes);
- myTableSettings.onScopeAdded();
- refreshAggregatedScopes();
+ final List descriptors = ContainerUtil.map(myTableSettings.getNodes(), new Function() {
+ @Override
+ public Descriptor fun(InspectionConfigTreeNode inspectionConfigTreeNode) {
+ return inspectionConfigTreeNode.getDefaultDescriptor();
+ }
+ });
+ final ScopesChooser scopesChooser = new ScopesChooser(descriptors, myInspectionProfile, myProject, myScopeNames) {
+ @Override
+ protected void onScopeAdded() {
+ myTableSettings.onScopeAdded();
+ refreshAggregatedScopes();
+ }
+
+ @Override
+ protected void onScopesOrderChanged() {
+ myTableSettings.onScopesOrderChanged();
+ }
+ };
+ DataContext dataContext = DataManager.getInstance().getDataContext(myTable);
+ final JComponent component = (JComponent)PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
+ final ListPopup popup = JBPopupFactory.getInstance()
+ .createActionGroupPopup(ScopesChooser.TITLE, scopesChooser.createPopupActionGroup(myTable), dataContext,
+ JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
+ final RelativePoint point = new RelativePoint(myTable, new Point(myTable.getWidth() - popup.getContent().getPreferredSize().width, 0));
+ popup.show(point);
}
@Override
diff --git a/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java b/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java
index 12b84f8db465..e619473197e7 100644
--- a/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java
+++ b/platform/platform-api/src/com/intellij/openapi/ui/NamedConfigurable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 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.
@@ -18,10 +18,12 @@ package com.intellij.openapi.ui;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.DocumentAdapter;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
+import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import java.awt.*;
@@ -55,6 +57,11 @@ public abstract class NamedConfigurable implements Configurable {
}
});
}
+ if (Registry.is("ide.new.project.settings")) {
+ myNamePanel.setBorder(new EmptyBorder(10, 10, 6, 10));
+ } else {
+ myNamePanel.setBorder(new EmptyBorder(0,0,0,0));
+ }
}
public boolean isNameEditable() {
diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java
index dac3354a24fb..b574926a7eb8 100644
--- a/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java
+++ b/platform/platform-api/src/com/intellij/ui/treeStructure/treetable/TreeTableTree.java
@@ -98,7 +98,9 @@ public class TreeTableTree extends Tree {
public void setVisibleRow(int row) {
myVisibleRow = row;
- setPreferredSize(new Dimension(getRowBounds(myVisibleRow).width, getPreferredSize().height));
+ final Rectangle rowBounds = getRowBounds(myVisibleRow);
+ final int indent = rowBounds.x - getVisibleRect().x;
+ setPreferredSize(new Dimension(getRowBounds(myVisibleRow).width + indent, getPreferredSize().height));
}
public void _processKeyEvent(KeyEvent e){
diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
index 28cd0a1a8af6..f89d92ffd026 100644
--- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java
@@ -36,6 +36,7 @@ import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.command.UndoConfirmationPolicy;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorFontType;
import com.intellij.openapi.editor.ex.*;
import com.intellij.openapi.editor.markup.ErrorStripeRenderer;
@@ -611,6 +612,8 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark
private void paintTrackBasement(Graphics g, Rectangle bounds) {
if (UISettings.getInstance().PRESENTATION_MODE || SystemInfo.isMac) {
+ g.setColor(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
+ g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
return;
}
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
index ee4cea4a9141..ab82b7e883d3 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
@@ -1485,8 +1485,8 @@ public class AbstractPopup implements JBPopup {
@Override
public Dimension getSize() {
if (myPopup != null) {
- final Window popupWindow = SwingUtilities.windowForComponent(myContent);
- return popupWindow.getSize();
+ final Window popupWindow = getContentWindow(myContent);
+ return (popupWindow == null) ? myForcedSize : popupWindow.getSize();
} else {
return myForcedSize;
}
@@ -1496,7 +1496,8 @@ public class AbstractPopup implements JBPopup {
public void moveToFitScreen() {
if (myPopup == null) return;
- final Window popupWindow = SwingUtilities.windowForComponent(myContent);
+ final Window popupWindow = getContentWindow(myContent);
+ if (popupWindow == null) return;
Rectangle bounds = popupWindow.getBounds();
ScreenUtil.moveRectangleToFitTheScreen(bounds);
@@ -1506,7 +1507,8 @@ public class AbstractPopup implements JBPopup {
public static Window setSize(JComponent content, final Dimension size) {
- final Window popupWindow = SwingUtilities.windowForComponent(content);
+ final Window popupWindow = getContentWindow(content);
+ if (popupWindow == null) return null;
Insets insets = content.getInsets();
if (insets != null) {
size.width += insets.left + insets.right;
diff --git a/platform/platform-resources-en/src/messages/CommonBundle.properties b/platform/platform-resources-en/src/messages/CommonBundle.properties
index 46750d536a06..1fbbd0a61f57 100644
--- a/platform/platform-resources-en/src/messages/CommonBundle.properties
+++ b/platform/platform-resources-en/src/messages/CommonBundle.properties
@@ -31,7 +31,6 @@ action.close=&Close
action.help=Help
action.rerun=Rerun
button.reset=&Reset
-button.reset.to.default=&Reset to Default
button.delete=Delete
button.copy=Copy...
button.close=&Close
diff --git a/platform/platform-resources-en/src/messages/VcsBundle.properties b/platform/platform-resources-en/src/messages/VcsBundle.properties
index 3d34252c9c7a..573cff8e6261 100644
--- a/platform/platform-resources-en/src/messages/VcsBundle.properties
+++ b/platform/platform-resources-en/src/messages/VcsBundle.properties
@@ -308,7 +308,7 @@ changes.action.rollback.custom.title={0} Changes
changes.action.rollback.nothing=Nothing to {0}
changes.dialog.editchangelist.error.already.exists=A changelist named ''{0}'' already exists
error.adding.files.prompt=The following problems have occurred when adding the files:
-error.adding.files.title=Error adding files
+error.adding.files.title=Error Adding Files
column.name.revision.list.committer=User
column.name.revision.list.number=Number
column.name.revision.list.description=Description
diff --git a/platform/platform-tests/testSrc/com/intellij/lang/PsiBuilderQuickTest.java b/platform/platform-tests/testSrc/com/intellij/lang/PsiBuilderQuickTest.java
index 5a47fdf4c5f3..cb83db5711f9 100644
--- a/platform/platform-tests/testSrc/com/intellij/lang/PsiBuilderQuickTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/lang/PsiBuilderQuickTest.java
@@ -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.
@@ -18,16 +18,14 @@ package com.intellij.lang;
import com.intellij.lang.impl.PsiBuilderImpl;
import com.intellij.lexer.Lexer;
import com.intellij.lexer.LexerBase;
+import com.intellij.openapi.fileTypes.PlainTextParserDefinition;
import com.intellij.openapi.project.Project;
-import com.intellij.psi.FileViewProvider;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
import com.intellij.psi.TokenType;
import com.intellij.psi.impl.DebugUtil;
import com.intellij.psi.impl.source.tree.ASTStructure;
import com.intellij.psi.tree.*;
-import com.intellij.testFramework.LightPlatformTestCase;
-import com.intellij.testFramework.PlatformTestCase;
+import com.intellij.testFramework.LightPlatformLangTestCase;
+import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.ThreeState;
import com.intellij.util.diff.DiffTree;
import com.intellij.util.diff.DiffTreeChangeBuilder;
@@ -36,12 +34,9 @@ import com.intellij.util.diff.ShallowNodeComparator;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
import java.util.List;
-public class PsiBuilderQuickTest extends LightPlatformTestCase {
+public class PsiBuilderQuickTest extends LightPlatformLangTestCase {
private static final IFileElementType ROOT = new IFileElementType("ROOT", Language.ANY);
private static final IElementType LETTER = new IElementType("LETTER", Language.ANY);
@@ -57,11 +52,6 @@ public class PsiBuilderQuickTest extends LightPlatformTestCase {
private static final TokenSet WHITESPACE_SET = TokenSet.create(TokenType.WHITE_SPACE);
private static final TokenSet COMMENT_SET = TokenSet.create(COMMENT);
- @SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
- public PsiBuilderQuickTest() {
- PlatformTestCase.initPlatformLangPrefix();
- }
-
public void testPlain() {
doTest("a<file is excluded or ignored, false otherwise.
*/
boolean isExcluded(@NotNull VirtualFile file);
+
+ /**
+ * Checks if the specified file or directory is located under project roots but the file itself or one of its parent directories is ignored
+ * by {@link com.intellij.openapi.fileTypes.FileTypeRegistry#isFileIgnored(com.intellij.openapi.vfs.VirtualFile)}).
+ *
+ * @param file the file to check.
+ * @return true if file is ignored, false otherwise.
+ */
+ boolean isUnderIgnored(@NotNull VirtualFile file);
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexExcludePolicy.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexExcludePolicy.java
index b31519ccb4a2..61838f51ac1d 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexExcludePolicy.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexExcludePolicy.java
@@ -17,7 +17,6 @@
package com.intellij.openapi.roots.impl;
import com.intellij.openapi.extensions.ExtensionPointName;
-import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ModuleRootModel;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
@@ -29,10 +28,9 @@ import org.jetbrains.annotations.NotNull;
public interface DirectoryIndexExcludePolicy {
ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.directoryIndexExcludePolicy");
- boolean isExcludeRoot(VirtualFile file);
- boolean isExcludeRootForModule(@NotNull Module module, final VirtualFile file);
@NotNull
VirtualFile[] getExcludeRootsForProject();
+
@NotNull
VirtualFilePointer[] getExcludeRootsForModule(@NotNull ModuleRootModel rootModel);
}
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java
index 0bb65c600083..e15763716280 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexFacade.java
@@ -69,6 +69,11 @@ public class ProjectFileIndexFacade extends FileIndexFacade {
return myFileIndex.isExcluded(file);
}
+ @Override
+ public boolean isUnderIgnored(@NotNull VirtualFile file) {
+ return myFileIndex.isUnderIgnored(file);
+ }
+
@Nullable
@Override
public Module getModuleForFile(@NotNull VirtualFile file) {
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
index 1609c58eb5c6..e2417193149e 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectFileIndexImpl.java
@@ -84,6 +84,11 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
return info.isIgnored() || info.isExcluded();
}
+ @Override
+ public boolean isUnderIgnored(@NotNull VirtualFile file) {
+ return getInfoForFileOrDirectory(file).isIgnored();
+ }
+
@Override
public Module getModuleForFile(@NotNull VirtualFile file) {
if (file instanceof VirtualFileWindow) file = ((VirtualFileWindow)file).getDelegate();
diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.java
index 85a098341e4e..8e80670b1f76 100644
--- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.java
+++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerImpl.java
@@ -131,8 +131,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
return (ProjectRootManagerImpl)getInstance(project);
}
- public ProjectRootManagerImpl(Project project,
- DirectoryIndex directoryIndex) {
+ public ProjectRootManagerImpl(Project project) {
myProject = project;
myRootsCache = new OrderRootsCache(project);
}
@@ -143,8 +142,6 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
return ProjectFileIndex.SERVICE.getInstance(myProject);
}
- private final Map myListenerAdapters = new HashMap();
-
@Override
@NotNull
public List getContentRootUrls() {
diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
index 5a4aca43a265..307fb65e5ef1 100644
--- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
+++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java
@@ -63,9 +63,7 @@ import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.InvocationEvent;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
+import java.io.*;
import java.lang.ref.SoftReference;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
@@ -826,4 +824,21 @@ public class PlatformTestUtil {
ReflectionUtil.resetField(Charset.class, Charset.class, "defaultCharset");
System.setProperty("file.encoding", encoding);
}
+
+ public static void withStdErrSuppressed(@NotNull Runnable r) {
+ PrintStream std = System.err;
+ System.setErr(new PrintStream(NULL));
+ try {
+ r.run();
+ }
+ finally {
+ System.setErr(std);
+ }
+ }
+
+ @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
+ private static final OutputStream NULL = new OutputStream() {
+ @Override
+ public void write(int b) throws IOException { }
+ };
}
diff --git a/platform/util/src/com/intellij/util/EventDispatcher.java b/platform/util/src/com/intellij/util/EventDispatcher.java
index 34361a8ff31b..e17c6e46e5f3 100644
--- a/platform/util/src/com/intellij/util/EventDispatcher.java
+++ b/platform/util/src/com/intellij/util/EventDispatcher.java
@@ -43,6 +43,7 @@ public class EventDispatcher {
}
private EventDispatcher(@NotNull Class listenerClass) {
+ LOG.assertTrue(listenerClass.isInterface(), "listenerClass must be an interface");
InvocationHandler handler = new InvocationHandler() {
@Override
@NonNls
@@ -71,10 +72,7 @@ public class EventDispatcher {
};
//noinspection unchecked
- myMulticaster = (T)Proxy.newProxyInstance(listenerClass.getClassLoader(),
- new Class[]{listenerClass},
- handler
- );
+ myMulticaster = (T)Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, handler);
}
@NotNull
@@ -82,7 +80,7 @@ public class EventDispatcher {
return myMulticaster;
}
- private void dispatch(final Method method, final Object[] args) {
+ private void dispatch(@NotNull Method method, Object[] args) {
method.setAccessible(true);
for (T listener : myListeners) {
diff --git a/platform/util/src/com/intellij/util/diff/DiffTree.java b/platform/util/src/com/intellij/util/diff/DiffTree.java
index 0bab60dc87da..680b15b7d1de 100644
--- a/platform/util/src/com/intellij/util/diff/DiffTree.java
+++ b/platform/util/src/com/intellij/util/diff/DiffTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 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.
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package com.intellij.util.diff;
import com.intellij.openapi.util.Ref;
@@ -39,7 +38,6 @@ public class DiffTree {
final FlyweightCapableTreeStructure newTree,
final ShallowNodeComparator comparator,
final DiffTreeChangeBuilder consumer) {
-
myOldTree = oldTree;
myNewTree = newTree;
myComparator = comparator;
@@ -53,7 +51,7 @@ public class DiffTree {
new DiffTree(oldTree, newTree, comparator, consumer).build(oldTree.getRoot(), newTree.getRoot(), 0);
}
- private static enum CompareResult {
+ private enum CompareResult {
EQUAL, // 100% equal
DRILL_DOWN_NEEDED, // element types are equal, but elements are composite
TYPE_ONLY, // only element types are equal
@@ -146,6 +144,7 @@ public class DiffTree {
newIndex++;
continue;
}
+
CompareResult c12 = looksEqual(comparator, oldChild1, newChild2);
if (c12 == CompareResult.EQUAL || c12 == CompareResult.DRILL_DOWN_NEEDED || c12 == CompareResult.TYPE_ONLY) {
myConsumer.nodeInserted(oldNode, newChild1, newIndex);
@@ -170,6 +169,7 @@ public class DiffTree {
oldIndex++;
continue;
}
+
myConsumer.nodeReplaced(oldChild1, newChild1);
oldIndex++;
newIndex++;
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java
index c09ce973634f..1091f908b600 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/IgnoredFileBean.java
@@ -26,7 +26,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
-import com.intellij.openapi.vfs.VfsUtil;
+import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.impl.NullVirtualFile;
import com.intellij.util.PatternUtil;
@@ -49,7 +49,8 @@ public class IgnoredFileBean {
myType = type;
if (IgnoreSettingsType.FILE.equals(type)) {
myFilenameIfFile = new File(path).getName();
- } else {
+ }
+ else {
myFilenameIfFile = null;
}
myProject = project;
@@ -115,9 +116,10 @@ public class IgnoredFileBean {
if (myType == IgnoreSettingsType.MASK) {
myMatcher.reset(file.getName());
return myMatcher.matches();
- } else {
+ }
+ else {
// quick check for 'file' == exact match pattern
- if (IgnoreSettingsType.FILE.equals(myType) && ! myFilenameIfFile.equals(file.getName())) return false;
+ if (IgnoreSettingsType.FILE.equals(myType) && !myFilenameIfFile.equals(file.getName())) return false;
VirtualFile selector = resolve();
if (Comparing.equal(selector, NullVirtualFile.INSTANCE)) return false;
@@ -130,7 +132,7 @@ public class IgnoredFileBean {
// special case for ignoring the project base dir (IDEADEV-16056)
return !file.isDirectory() && Comparing.equal(file.getParent(), selector);
}
- return VfsUtil.isAncestor(selector, file, false);
+ return VfsUtilCore.isAncestor(selector, file, false);
}
}
}
@@ -146,7 +148,9 @@ public class IgnoredFileBean {
@Nullable
private VirtualFile doResolve() {
- if (myProject == null || myProject.isDisposed()) { return null; }
+ if (myProject == null || myProject.isDisposed()) {
+ return null;
+ }
VirtualFile baseDir = myProject.getBaseDir();
String path = FileUtil.toSystemIndependentName(myPath);
diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeModifier.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeModifier.java
index b97305c1a0a3..c8a8eda7a436 100644
--- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeModifier.java
+++ b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeModifier.java
@@ -17,7 +17,7 @@ package com.intellij.openapi.vcs.changes;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Iterator;
@@ -28,7 +28,7 @@ import java.util.Iterator;
public interface VcsDirtyScopeModifier {
Iterator getDirtyFilesIterator();
Collection getAffectedVcsRoots();
- @Nullable
+ @NotNull
Iterator getDirtyDirectoriesIterator(VirtualFile root);
void recheckDirtyKeys();
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
index b9f0855c175c..fbe0df70bd5f 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java
@@ -68,7 +68,8 @@ import java.util.concurrent.atomic.AtomicReference;
/**
* @author max
*/
-public class ChangeListManagerImpl extends ChangeListManagerEx implements ProjectComponent, ChangeListOwner, JDOMExternalizable, RoamingTypeDisabled {
+public class ChangeListManagerImpl extends ChangeListManagerEx implements ProjectComponent, ChangeListOwner, JDOMExternalizable,
+ RoamingTypeDisabled {
public static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.ChangeListManagerImpl");
private final Project myProject;
@@ -191,6 +192,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
/**
* Shows the proposal to delete one or more changelists that were default and became empty.
+ *
* @return true if the changelists have to be deleted, false if not.
*/
private boolean showRemoveEmptyChangeListsProposal(@NotNull final VcsConfiguration config, @NotNull Collection lists) {
@@ -242,7 +244,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
public void unblockModalNotifications() {
myModalNotificationsBlocked = false;
if (myListsToBeDeleted.isEmpty()) {
- return ;
+ return;
}
if (showRemoveEmptyChangeListsProposal(myConfig, myListsToBeDeleted)) {
for (LocalChangeList list : myListsToBeDeleted) {
@@ -261,14 +263,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
vcsManager.addVcsListener(myVcsListener);
}
else {
- ((ProjectLevelVcsManagerImpl) vcsManager).addInitializationRequest(
+ ((ProjectLevelVcsManagerImpl)vcsManager).addInitializationRequest(
VcsInitObject.CHANGE_LIST_MANAGER, new DumbAwareRunnable() {
- public void run() {
- myUpdater.initialized();
- broadcastStateAfterLoad();
- vcsManager.addVcsListener(myVcsListener);
- }
- });
+ public void run() {
+ myUpdater.initialized();
+ broadcastStateAfterLoad();
+ vcsManager.addVcsListener(myVcsListener);
+ }
+ });
}
myConflictTracker.startTracking();
@@ -328,11 +330,12 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
/**
* update itself might produce actions done on AWT thread (invoked-after),
- * so waiting for its completion on AWT thread is not good
- *
- * runnable is invoked on AWT thread
+ * so waiting for its completion on AWT thread is not good runnable is invoked on AWT thread
*/
- public void invokeAfterUpdate(final Runnable afterUpdate, final InvokeAfterUpdateMode mode, @Nullable final String title, @Nullable final ModalityState state) {
+ public void invokeAfterUpdate(final Runnable afterUpdate,
+ final InvokeAfterUpdateMode mode,
+ @Nullable final String title,
+ @Nullable final ModalityState state) {
myUpdater.invokeAfterUpdate(afterUpdate, mode, title, null, state);
}
@@ -394,13 +397,13 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
synchronized (myDataLock) {
final IgnoredFilesHolder fileHolder = (IgnoredFilesHolder)myComposite.get(FileHolder.HolderType.IGNORED);
- for (Iterator iterator = scopes.iterator(); iterator.hasNext();) {
- final VcsModifiableDirtyScope scope = (VcsModifiableDirtyScope) iterator.next();
+ for (Iterator iterator = scopes.iterator(); iterator.hasNext(); ) {
+ final VcsModifiableDirtyScope scope = (VcsModifiableDirtyScope)iterator.next();
final VcsDirtyScopeModifier modifier = scope.getModifier();
if (modifier != null) {
fileHolder.notifyVcsStarted(scope.getVcs());
final Iterator filesIterator = modifier.getDirtyFilesIterator();
- for (; filesIterator.hasNext();) {
+ while (filesIterator.hasNext()) {
final FilePath dirtyFile = filesIterator.next();
if ((dirtyFile.getVirtualFile() != null) && isIgnoredFile(dirtyFile.getVirtualFile())) {
filesIterator.remove();
@@ -411,7 +414,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
final Collection roots = modifier.getAffectedVcsRoots();
for (VirtualFile root : roots) {
final Iterator dirIterator = modifier.getDirtyDirectoriesIterator(root);
- for (; dirIterator.hasNext(); ) {
+ while (dirIterator.hasNext()) {
final FilePath dir = dirIterator.next();
if ((dir.getVirtualFile() != null) && isIgnoredFile(dir.getVirtualFile())) {
dirIterator.remove();
@@ -428,10 +431,10 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
}
}
- catch(Exception ex) {
+ catch (Exception ex) {
LOG.error(ex);
}
- catch(AssertionError ex) {
+ catch (AssertionError ex) {
LOG.error(ex);
}
for (VirtualFile file : refreshFiles) {
@@ -443,7 +446,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
final DataHolder dataHolder;
final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
- if (! vcsManager.hasActiveVcss()) return;
+ if (!vcsManager.hasActiveVcss()) return;
final VcsInvalidated invalidated = myDirtyScopeManager.retrieveScopes();
if (checkScopeIsEmpty(invalidated)) return;
@@ -458,14 +461,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
// mark for "modifier" that update started (it would create duplicates of modification commands done by user during update;
// after update of copies of objects is complete, it would apply the same modifications to copies.)
synchronized (myDataLock) {
- dataHolder = new DataHolder((FileHolderComposite) myComposite.copy(), myWorker.copy(), wasEverythingDirty);
+ dataHolder = new DataHolder((FileHolderComposite)myComposite.copy(), myWorker.copy(), wasEverythingDirty);
myModifier.enterUpdate();
if (wasEverythingDirty) {
myUpdateException = null;
myAdditionalInfo = null;
}
}
- final String scopeInString = (! LOG.isDebugEnabled()) ? "" : StringUtil.join(scopes, new Function() {
+ final String scopeInString = (!LOG.isDebugEnabled()) ? "" : StringUtil.join(scopes, new Function() {
@Override
public String fun(VcsDirtyScope scope) {
return scope.toString();
@@ -504,7 +507,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
myWorker.onAfterWorkerSwitch(oldWorker);
myModifier.setWorker(myWorker);
LOG.debug("refresh procedure finished, unversioned size: " +
- dataHolder.getComposite().getVFHolder(FileHolder.HolderType.UNVERSIONED).getSize() + "\n changes: " + myWorker);
+ dataHolder.getComposite().getVFHolder(FileHolder.HolderType.UNVERSIONED).getSize() + "\n changes: " + myWorker);
final boolean statusChanged = !myComposite.equals(dataHolder.getComposite());
myComposite = dataHolder.getComposite();
if (statusChanged) {
@@ -535,19 +538,20 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
catch (DisposedException e) {
// OK, we're finishing all the stuff now.
}
- catch(ProcessCanceledException e) {
+ catch (ProcessCanceledException e) {
// OK, we're finishing all the stuff now.
- } catch (RuntimeInterruptedException ignore) {
}
- catch(Exception ex) {
+ catch (RuntimeInterruptedException ignore) {
+ }
+ catch (Exception ex) {
LOG.error(ex);
}
- catch(AssertionError ex) {
+ catch (AssertionError ex) {
LOG.error(ex);
}
finally {
myDirtyScopeManager.changesProcessed();
-
+
synchronized (myDataLock) {
myDelayedNotificator.getProxyDispatcher().changeListUpdateDone();
myChangesViewManager.scheduleRefresh();
@@ -556,7 +560,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
private boolean checkScopeIsAllIgnored(VcsInvalidated invalidated) {
- if (! invalidated.isEverythingDirty()) {
+ if (!invalidated.isEverythingDirty()) {
filterOutIgnoredFiles(invalidated.getScopes());
if (invalidated.isEmpty()) {
return true;
@@ -586,7 +590,8 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
};
final UpdatingChangeListBuilder builder = new UpdatingChangeListBuilder(dataHolder.getChangeListWorker(),
- dataHolder.getComposite(), disposedGetter, myIgnoredIdeaLevel, gate);
+ dataHolder.getComposite(), disposedGetter, myIgnoredIdeaLevel,
+ gate);
for (final VcsDirtyScope scope : scopes) {
myUpdateChangesProgressIndicator.checkCanceled();
@@ -594,7 +599,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
final AbstractVcs vcs = scope.getVcs();
if (vcs == null) continue;
scope.setWasEverythingDirty(wasEverythingDirty);
- final VcsModifiableDirtyScope adjustedScope = vcs.adjustDirtyScope((VcsModifiableDirtyScope) scope);
+ final VcsModifiableDirtyScope adjustedScope = vcs.adjustDirtyScope((VcsModifiableDirtyScope)scope);
myChangesViewManager.setBusy(true);
dataHolder.notifyStartProcessingChanges(adjustedScope);
@@ -614,7 +619,8 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
final ContentRevisionCache cache = ProjectLevelVcsManager.getInstance(myProject).getContentRevisionCache();
if (invalidated.isEverythingDirty()) {
cache.clearAllCurrent();
- } else {
+ }
+ else {
cache.clearScope(invalidated.getScopes());
}
}
@@ -625,6 +631,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
public boolean isCanceled() {
return myUpdater.isStopped();
}
+
@Override
public void checkCanceled() {
checkIfDisposed();
@@ -651,7 +658,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
public void notifyStartProcessingChanges(@NotNull final VcsModifiableDirtyScope scope) {
- if (! myWasEverythingDirty) {
+ if (!myWasEverythingDirty) {
myComposite.cleanAndAdjustScope(scope);
myChangeListWorker.notifyStartProcessingChanges(scope);
}
@@ -661,7 +668,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
public void notifyDoneProcessingChanges() {
- if (! myWasEverythingDirty) {
+ if (!myWasEverythingDirty) {
myChangeListWorker.notifyDoneProcessingChanges(myDelayedNotificator.getProxyDispatcher());
}
}
@@ -695,11 +702,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
handleUpdateException(e);
}
}
- } catch (ProcessCanceledException ignore) {
- } catch (Throwable t) {
+ }
+ catch (ProcessCanceledException ignore) {
+ }
+ catch (Throwable t) {
LOG.debug(t);
Rethrow.reThrowRuntime(t);
- } finally {
+ }
+ finally {
if (!myUpdater.isStopped()) {
dataHolder.notifyDoneProcessingChanges();
}
@@ -748,8 +758,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
/**
- * @deprecated
- * this method made equivalent to {@link #getChangeListsCopy()} so to don't be confused by method name,
+ * @deprecated this method made equivalent to {@link #getChangeListsCopy()} so to don't be confused by method name,
* better use {@link #getChangeListsCopy()}
*/
@NotNull
@@ -816,13 +825,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
Map getLogicallyLockedFolders() {
synchronized (myDataLock) {
- return new HashMap(((LogicallyLockedHolder) myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).getMap());
+ return new HashMap(
+ ((LogicallyLockedHolder)myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).getMap());
}
}
public boolean isLogicallyLocked(final VirtualFile file) {
synchronized (myDataLock) {
- return ((LogicallyLockedHolder) myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).containsKey(file);
+ return ((LogicallyLockedHolder)myComposite.get(FileHolder.HolderType.LOGICALLY_LOCKED)).containsKey(file);
}
}
@@ -847,7 +857,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
@Nullable
Map getSwitchedRoots() {
synchronized (myDataLock) {
- return ((SwitchedFileHolder) myComposite.get(FileHolder.HolderType.ROOT_SWITCH)).getFilesMapCopy();
+ return ((SwitchedFileHolder)myComposite.get(FileHolder.HolderType.ROOT_SWITCH)).getFilesMapCopy();
}
}
@@ -856,7 +866,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
return myUpdateException;
}
}
-
+
public Factory getAdditionalUpdateInfo() {
synchronized (myDataLock) {
return myAdditionalInfo;
@@ -937,7 +947,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
synchronized (myDataLock) {
for (Map.Entry> entry : map.entrySet()) {
final List changes = entry.getValue();
- for (Iterator iterator = changes.iterator(); iterator.hasNext();) {
+ for (Iterator iterator = changes.iterator(); iterator.hasNext(); ) {
final Change change = iterator.next();
if (getChangeList(change) != null) {
// was not actually rolled back
@@ -948,7 +958,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
for (String listName : map.keySet()) {
final LocalChangeList byName = myWorker.getCopyByName(listName);
- if (byName != null && byName.getChanges().isEmpty() && ! byName.isDefault() && ! byName.isReadOnly()) {
+ if (byName != null && byName.getChanges().isEmpty() && !byName.isDefault() && !byName.isReadOnly()) {
myWorker.removeChangeList(listName);
}
}
@@ -1005,15 +1015,14 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
/**
- * @deprecated
- * better use normal comparison, with equals
+ * @deprecated better use normal comparison, with equals
*/
@Nullable
public LocalChangeList getIdentityChangeList(Change change) {
synchronized (myDataLock) {
final List lists = myWorker.getListsCopy();
for (LocalChangeList list : lists) {
- for(Change oldChange: list.getChanges()) {
+ for (Change oldChange : list.getChanges()) {
if (oldChange == change) {
return list;
}
@@ -1168,7 +1177,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
if (exceptions.size() > 0) {
StringBuilder message = new StringBuilder(VcsBundle.message("error.adding.files.prompt"));
- for(VcsException ex: exceptions) {
+ for (VcsException ex : exceptions) {
message.append("\n").append(ex.getMessage());
}
Messages.showErrorDialog(myProject, message.toString(), VcsBundle.message("error.adding.files.title"));
@@ -1189,7 +1198,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
synchronized (myDataLock) {
List changesToMove = new ArrayList();
final LocalChangeList defaultList = getDefaultChangeList();
- for(Change change: defaultList.getChanges()) {
+ for (Change change : defaultList.getChanges()) {
final ContentRevision afterRevision = change.getAfterRevision();
if (afterRevision != null) {
VirtualFile vFile = afterRevision.getFile().getVirtualFile();
@@ -1208,8 +1217,9 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
myChangesViewManager.scheduleRefresh();
}
- }, InvokeAfterUpdateMode.BACKGROUND_NOT_CANCELLABLE_NOT_AWT, VcsBundle.message("change.lists.manager.add.unversioned"), null);
- } else {
+ }, InvokeAfterUpdateMode.BACKGROUND_NOT_CANCELLABLE_NOT_AWT, VcsBundle.message("change.lists.manager.add.unversioned"), null);
+ }
+ else {
myChangesViewManager.scheduleRefresh();
}
}
@@ -1238,8 +1248,8 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
private boolean doCommit(final LocalChangeList changeList, final List changes, final boolean synchronously) {
FileDocumentManager.getInstance().saveAllDocuments();
return new CommitHelper(myProject, changeList, changes, changeList.getName(),
- StringUtil.isEmpty(changeList.getComment()) ? changeList.getName() : changeList.getComment(),
- new ArrayList(), false, synchronously, NullableFunction.NULL, null).doCommit();
+ StringUtil.isEmpty(changeList.getComment()) ? changeList.getName() : changeList.getComment(),
+ new ArrayList(), false, synchronously, NullableFunction.NULL, null).doCommit();
}
public void commitChangesSynchronously(LocalChangeList changeList, List changes) {
@@ -1252,11 +1262,11 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
@SuppressWarnings({"unchecked"})
public void readExternal(Element element) throws InvalidDataException {
- if (! myProject.isDefault()) {
+ if (!myProject.isDefault()) {
synchronized (myDataLock) {
myIgnoredIdeaLevel.clear();
new ChangeListManagerSerialization(myIgnoredIdeaLevel, myWorker).readExternal(element);
- if ((! myWorker.isEmpty()) && getDefaultChangeList() == null) {
+ if ((!myWorker.isEmpty()) && getDefaultChangeList() == null) {
setDefaultChangeList(myWorker.getListsCopy().get(0));
}
}
@@ -1265,7 +1275,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
public void writeExternal(Element element) throws WriteExternalException {
- if (! myProject.isDefault()) {
+ if (!myProject.isDefault()) {
final IgnoredFilesComponent ignoredFilesComponent;
final ChangeListWorker worker;
synchronized (myDataLock) {
@@ -1316,10 +1326,11 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
if (vf.isDirectory()) {
myDirs.add(vf);
- } else {
+ }
+ else {
myFiles.add(vf);
}
- ++ myCnt;
+ ++myCnt;
}
}
@@ -1327,7 +1338,8 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
final VcsDirtyScopeManager vcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);
if (myEveryThing) {
vcsDirtyScopeManager.markEverythingDirty();
- } else {
+ }
+ else {
vcsDirtyScopeManager.filesDirty(myFiles, myDirs);
}
}
@@ -1343,7 +1355,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
synchronized (myDataLock) {
final VirtualFileHolder unversionedHolder = myComposite.getVFHolder(FileHolder.HolderType.UNVERSIONED);
- final IgnoredFilesHolder ignoredHolder = (IgnoredFilesHolder) myComposite.get(FileHolder.HolderType.IGNORED);
+ final IgnoredFilesHolder ignoredHolder = (IgnoredFilesHolder)myComposite.get(FileHolder.HolderType.IGNORED);
scheduler.accept(unversionedHolder.getFiles());
scheduler.accept(ignoredHolder.values());
@@ -1368,7 +1380,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
}
private void exchangeWithIgnored(FileHolderComposite composite, VirtualFileHolder vfHolder, List unversionedFiles) {
- for(VirtualFile file: unversionedFiles) {
+ for (VirtualFile file : unversionedFiles) {
if (isIgnoredFile(file)) {
vfHolder.removeFile(file);
composite.getIgnoredFileHolder().addFile(file);
@@ -1594,11 +1606,11 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
if (freezeReason != null) {
if (modalTitle != null) {
Messages.showErrorDialog(myProject, freezeReason, modalTitle);
- } else {
+ }
+ else {
VcsBalloonProblemNotifier.showOverChangesView(myProject, freezeReason, MessageType.WARNING);
}
}
return freezeReason != null;
}
-
}
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerSerialization.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerSerialization.java
index a4c30e62bda5..311bcacd5bdb 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerSerialization.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerSerialization.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.WriteExternalException;
import com.intellij.openapi.util.text.StringUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
@@ -60,7 +61,7 @@ class ChangeListManagerSerialization {
readChangeList(listNode);
}
final List ignoredNodes = element.getChildren(NODE_IGNORED);
- for (Element ignoredNode: ignoredNodes) {
+ for (Element ignoredNode : ignoredNodes) {
readFileToIgnore(ignoredNode);
}
}
@@ -90,7 +91,6 @@ class ChangeListManagerSerialization {
if (ATT_VALUE_TRUE.equals(listNode.getAttributeValue(ATT_READONLY))) {
list.setReadOnly(true);
}
-
}
private void readFileToIgnore(final Element ignoredNode) {
@@ -123,7 +123,10 @@ class ChangeListManagerSerialization {
listNode.setAttribute(ATT_ID, list.getId());
listNode.setAttribute(ATT_NAME, list.getName());
- listNode.setAttribute(ATT_COMMENT, list.getComment());
+ String comment = list.getComment();
+ if (comment != null) {
+ listNode.setAttribute(ATT_COMMENT, comment);
+ }
List changes = new ArrayList(list.getChanges());
Collections.sort(changes, new ChangeComparator());
for (Change change : changes) {
@@ -131,26 +134,27 @@ class ChangeListManagerSerialization {
}
}
final IgnoredFileBean[] filesToIgnore = myIgnoredIdeaLevel.getFilesToIgnore();
- for(IgnoredFileBean bean: filesToIgnore) {
- Element fileNode = new Element(NODE_IGNORED);
- element.addContent(fileNode);
- String path = bean.getPath();
- if (path != null) {
- fileNode.setAttribute("path", path);
- }
- String mask = bean.getMask();
- if (mask != null) {
- fileNode.setAttribute("mask", mask);
- }
+ for (IgnoredFileBean bean : filesToIgnore) {
+ Element fileNode = new Element(NODE_IGNORED);
+ element.addContent(fileNode);
+ String path = bean.getPath();
+ if (path != null) {
+ fileNode.setAttribute("path", path);
}
+ String mask = bean.getMask();
+ if (mask != null) {
+ fileNode.setAttribute("mask", mask);
+ }
+ }
}
private static class ChangeComparator implements Comparator {
@Override
- public int compare(Change o1, Change o2) {
+ public int compare(@NotNull Change o1, @NotNull Change o2) {
return Comparing.compare(o1.toString(), o2.toString());
}
}
+
private static void writeChange(final Element listNode, final Change change) {
Element changeNode = new Element(NODE_CHANGE);
listNode.addContent(changeNode);
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java
index 5c8ac2a6b623..87fe35d21922 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/IgnoredFilesComponent.java
@@ -48,7 +48,7 @@ public class IgnoredFilesComponent {
}
public void add(final IgnoredFileBean... filesToIgnore) {
- synchronized(myFilesToIgnore) {
+ synchronized (myFilesToIgnore) {
Collections.addAll(myFilesToIgnore, filesToIgnore);
addIgnoredFiles(filesToIgnore);
}
@@ -73,6 +73,7 @@ public class IgnoredFilesComponent {
myFilesMap.clear();
}
}
+
public boolean isEmpty() {
synchronized (myFilesToIgnore) {
return myFilesToIgnore.isEmpty();
@@ -80,7 +81,7 @@ public class IgnoredFilesComponent {
}
public void set(final IgnoredFileBean... filesToIgnore) {
- synchronized(myFilesToIgnore) {
+ synchronized (myFilesToIgnore) {
myFilesToIgnore.clear();
Collections.addAll(myFilesToIgnore, filesToIgnore);
myFilesMap.clear();
@@ -89,7 +90,7 @@ public class IgnoredFilesComponent {
}
public IgnoredFileBean[] getFilesToIgnore() {
- synchronized(myFilesToIgnore) {
+ synchronized (myFilesToIgnore) {
return myFilesToIgnore.toArray(new IgnoredFileBean[myFilesToIgnore.size()]);
}
}
@@ -103,14 +104,14 @@ public class IgnoredFilesComponent {
}
public boolean isIgnoredFile(@NotNull VirtualFile file) {
- synchronized(myFilesToIgnore) {
+ synchronized (myFilesToIgnore) {
if (myFilesToIgnore.size() == 0) return false;
final String path = FilePathsHelper.convertPath(file);
final IgnoredFileBean fileBean = myFilesMap.get(path);
if (fileBean != null && fileBean.matchesFile(file)) return true;
- for(IgnoredFileBean bean: myFilesToIgnore) {
+ for (IgnoredFileBean bean : myFilesToIgnore) {
if (bean.matchesFile(file)) return true;
}
return false;
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java
index eb44d591d605..c8617dc5f347 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/VcsDirtyScopeImpl.java
@@ -34,6 +34,7 @@ import com.intellij.util.containers.Convertor;
import com.intellij.util.containers.MultiMap;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -75,14 +76,14 @@ public class VcsDirtyScopeImpl extends VcsModifiableDirtyScope {
return ContainerUtil.concatIterators(iteratorList);
}
- @Nullable
+ @NotNull
@Override
public Iterator getDirtyDirectoriesIterator(final VirtualFile root) {
final THashSet filePaths = myDirtyDirectoriesRecursively.get(root);
if (filePaths != null) {
return filePaths.iterator();
}
- return null;
+ return ContainerUtil.emptyIterator();
}
@Override
@@ -338,10 +339,8 @@ public class VcsDirtyScopeImpl extends VcsModifiableDirtyScope {
}
/**
- * Add dirty file to the scope. Note that file is not added
- * if its ancestor was added as dirty recursively or if its parent
- * is in already in the dirty scope. Also immendiate non-directory
- * children are removed from the set of dirty files.
+ * Add dirty file to the scope. Note that file is not added if its ancestor was added as dirty recursively or if its parent is in already
+ * in the dirty scope. Also immediate non-directory children are removed from the set of dirty files.
*
* @param newcomer a file or directory added to the dirty scope.
*/
diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java
index a63bbdbf0a69..d4063478d373 100644
--- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java
+++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/DefaultFileIndexFacade.java
@@ -65,6 +65,11 @@ public class DefaultFileIndexFacade extends FileIndexFacade {
return false;
}
+ @Override
+ public boolean isUnderIgnored(@NotNull VirtualFile file) {
+ return false;
+ }
+
@Override
public Module getModuleForFile(@NotNull VirtualFile file) {
return null;
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java
index 5b4c0c9c8305..adfff487443e 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java
@@ -515,7 +515,10 @@ public class IfCanBeSwitchInspection extends BaseInspection {
super.readSettings(node);
for (Element child : node.getChildren("option")) {
if (Comparing.strEqual(child.getAttributeValue("name"), ONLY_SAFE)) {
- onlySuggestNullSafe = Boolean.parseBoolean(child.getAttributeValue("value"));
+ final String value = child.getAttributeValue("value");
+ if (value != null) {
+ onlySuggestNullSafe = Boolean.parseBoolean(value);
+ }
break;
}
}
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java
index 84b96c39fd78..0d063527027d 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/mvc/GroovySdkWizardStepBase.java
@@ -23,7 +23,6 @@ import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.ide.wizard.CommitStepException;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
@@ -51,8 +50,7 @@ public abstract class GroovySdkWizardStepBase extends ModuleWizardStep {
public GroovySdkWizardStepBase(@Nullable final MvcFramework framework, WizardContext wizardContext, String basePath) {
myBasePath = basePath;
- final Project project = wizardContext.getProject();
- myLibrariesContainer = LibrariesContainerFactory.createContainer(project);
+ myLibrariesContainer = LibrariesContainerFactory.createContainer(wizardContext, wizardContext.getModulesProvider());
myFramework = framework;
}
diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
index caaa54166e7d..65d2f38756a0 100644
--- a/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
+++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalDirectRunner.java
@@ -77,10 +77,14 @@ public class LocalTerminalDirectRunner extends AbstractTerminalRunner