Merge remote-tracking branch 'origin/master'
|
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 389 B |
|
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 441 B |
|
Before Width: | Height: | Size: 438 B After Width: | Height: | Size: 334 B |
|
Before Width: | Height: | Size: 809 B After Width: | Height: | Size: 572 B |
|
Before Width: | Height: | Size: 581 B After Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 816 B After Width: | Height: | Size: 619 B |
|
Before Width: | Height: | Size: 605 B After Width: | Height: | Size: 290 B |
|
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 636 B |
|
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 188 B |
|
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 294 B |
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 283 B |
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 393 B |
|
Before Width: | Height: | Size: 825 B After Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 243 B |
|
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 292 B |
|
Before Width: | Height: | Size: 441 B After Width: | Height: | Size: 427 B |
|
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 360 B |
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 219 B After Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 236 B |
|
Before Width: | Height: | Size: 358 B After Width: | Height: | Size: 388 B |
|
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 347 B |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 374 B |
|
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 566 B |
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 605 B |
|
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 334 B |
@@ -543,7 +543,7 @@ public abstract class TabbedLanguageCodeStylePanel extends CodeStyleAbstractPane
|
||||
|
||||
//========================================================================================================================================
|
||||
|
||||
private class MyIndentOptionsWrapper extends CodeStyleAbstractPanel {
|
||||
protected class MyIndentOptionsWrapper extends CodeStyleAbstractPanel {
|
||||
|
||||
private final IndentOptionsEditor myEditor;
|
||||
private final LanguageCodeStyleSettingsProvider myProvider;
|
||||
|
||||
@@ -248,7 +248,7 @@ public class JBOptionButton extends JButton implements MouseMotionListener {
|
||||
};
|
||||
|
||||
if (under && myOptions.length > 0) {
|
||||
final JMenuItem mainAction = new JMenuItem(getAction());
|
||||
final JMenuItem mainAction = createMenuItem(getAction());
|
||||
configureItem(getMenuInfo(getAction()), mainAction);
|
||||
result.add(mainAction);
|
||||
result.addSeparator();
|
||||
@@ -257,7 +257,7 @@ public class JBOptionButton extends JButton implements MouseMotionListener {
|
||||
for (Action each : myOptions) {
|
||||
if (getAction() == each) continue;
|
||||
final OptionInfo info = getMenuInfo(each);
|
||||
final JMenuItem eachItem = new JMenuItem(each);
|
||||
final JMenuItem eachItem = createMenuItem(each);
|
||||
|
||||
configureItem(info, eachItem);
|
||||
result.add(eachItem);
|
||||
@@ -265,7 +265,7 @@ public class JBOptionButton extends JButton implements MouseMotionListener {
|
||||
|
||||
if (!under && myOptions.length > 0) {
|
||||
result.addSeparator();
|
||||
final JMenuItem mainAction = new JMenuItem(getAction());
|
||||
final JMenuItem mainAction = createMenuItem(getAction());
|
||||
configureItem(getMenuInfo(getAction()), mainAction);
|
||||
result.add(mainAction);
|
||||
}
|
||||
@@ -273,6 +273,16 @@ public class JBOptionButton extends JButton implements MouseMotionListener {
|
||||
return result;
|
||||
}
|
||||
|
||||
private JMenuItem createMenuItem(final Action action) {
|
||||
return new JMenuItem(action) {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
GraphicsUtil.setupAntialiasing(g);
|
||||
super.paint(g);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void configureItem(OptionInfo info, JMenuItem eachItem) {
|
||||
eachItem.setText(info.myPlainText);
|
||||
if (info.myMnemonic >= 0) {
|
||||
|
||||
@@ -18,17 +18,15 @@ public class HideableTitledPanel extends JPanel {
|
||||
|
||||
private TitledSeparator myTitledSeparator;
|
||||
private boolean myOn;
|
||||
private final JComponent myContent;
|
||||
private JComponent myContent;
|
||||
private Dimension myPreviousContentSize;
|
||||
|
||||
public HideableTitledPanel(String title, JComponent content, boolean on) {
|
||||
public HideableTitledPanel(String title) {
|
||||
super(new BorderLayout());
|
||||
myContent = content;
|
||||
add(myContent, BorderLayout.CENTER);
|
||||
myTitledSeparator = new TitledSeparator(title, null);
|
||||
add(myTitledSeparator, BorderLayout.NORTH);
|
||||
myTitledSeparator.getLabel().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
myTitledSeparator.getLabel().addMouseListener(new MouseAdapter() {
|
||||
myTitledSeparator.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
myTitledSeparator.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (myOn) {
|
||||
@@ -39,10 +37,19 @@ public class HideableTitledPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public HideableTitledPanel(String title, JComponent content, boolean on) {
|
||||
this(title);
|
||||
setContentComponent(content);
|
||||
setOn(on);
|
||||
}
|
||||
|
||||
protected void setContentComponent(JComponent content) {
|
||||
myContent = content;
|
||||
add(myContent, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
public void setOn(boolean on) {
|
||||
myOn = on;
|
||||
if (myOn) {
|
||||
@@ -53,6 +60,10 @@ public class HideableTitledPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isExpanded() {
|
||||
return myOn;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
myTitledSeparator.setText(title);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,16 @@ public enum ChangeTypeEnum {
|
||||
return myCode;
|
||||
}
|
||||
|
||||
public static ChangeTypeEnum getChangeType(final long type) {
|
||||
final ChangeTypeEnum[] values = values();
|
||||
for (ChangeTypeEnum value : values) {
|
||||
if (value.getCode() == type) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ChangeTypeEnum getChangeType(final Change change) {
|
||||
if (change.getBeforeRevision() == null) {
|
||||
return ADD;
|
||||
|
||||
@@ -83,6 +83,22 @@ public class HistoryCacheManager {
|
||||
return myDbUtil.readLists(vcs, location, lastRev, oldRev);
|
||||
}
|
||||
|
||||
public long getLastRevision(final AbstractVcs vcs, final RepositoryLocation location) {
|
||||
return myDbUtil.getLastRevision(vcs, location2string(location));
|
||||
}
|
||||
|
||||
private String location2string(RepositoryLocation location) {
|
||||
return FileUtil.toSystemIndependentName(location.toPresentableString());
|
||||
}
|
||||
|
||||
public long getFirstRevision(final AbstractVcs vcs, final RepositoryLocation location) {
|
||||
return myDbUtil.getFirstRevision(vcs, location2string(location));
|
||||
}
|
||||
|
||||
public PathState getPathState(final AbstractVcs vcs, final RepositoryLocation location, final String path) throws VcsException {
|
||||
return myDbUtil.getPathState(vcs, location, path);
|
||||
}
|
||||
|
||||
private class AppendChanges extends Task.Backgroundable {
|
||||
private final List<CommittedChangeList> myLists;
|
||||
private final String myRoot;
|
||||
@@ -134,7 +150,7 @@ public class HistoryCacheManager {
|
||||
myCachesHolder.iterateAllRepositoryLocations(new PairProcessor<RepositoryLocation, AbstractVcs>() {
|
||||
@Override
|
||||
public boolean process(RepositoryLocation location, AbstractVcs vcs) {
|
||||
map.putValue(vcs.getName(), FileUtil.toSystemIndependentName(location.toPresentableString()));
|
||||
map.putValue(vcs.getName(), location2string(location));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.vcs.changes.dbCommitted;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: Irina.Chernushina
|
||||
* Date: 10/11/12
|
||||
* Time: 5:56 PM
|
||||
*/
|
||||
public class PathState {
|
||||
private final long myLastRevision;
|
||||
private final boolean myExistsInLastRevision;
|
||||
|
||||
public PathState(long lastRevision, boolean existsInLastRevision) {
|
||||
myLastRevision = lastRevision;
|
||||
myExistsInLastRevision = existsInLastRevision;
|
||||
}
|
||||
|
||||
public long getLastRevision() {
|
||||
return myLastRevision;
|
||||
}
|
||||
|
||||
public boolean isExistsInLastRevision() {
|
||||
return myExistsInLastRevision;
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,8 @@ public interface SqliteTables {
|
||||
String PREPARED_INSERT_PATH = "PREPARED_INSERT_PATH";
|
||||
String PREPARED_INSERT_PATH_2_REVS = "PREPARED_INSERT_PATH_2_REVS";
|
||||
String PREPARED_SELECT_REVISIONS = "PREPARED_SELECT_REVISIONS";
|
||||
String PREPARED_SELECT_PATH_DATA = "PREPARED_SELECT_PATH_DATA";
|
||||
String PREPARED_PATHS_2_REVS = "PREPARED_PATHS_2_REVS";
|
||||
|
||||
abstract class BaseTable {
|
||||
public final String ID;
|
||||
|
||||
@@ -12,6 +12,12 @@
|
||||
* 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.
|
||||
* TODO quotations!
|
||||
* TODO quotations!
|
||||
* TODO quotations!
|
||||
* TODO quotations!
|
||||
* TODO quotations!
|
||||
* TODO quotations!
|
||||
*/
|
||||
package com.intellij.openapi.vcs.changes.dbCommitted;
|
||||
|
||||
@@ -256,13 +262,21 @@ public class VcsSqliteLayer {
|
||||
|
||||
long maxRev = -1;
|
||||
long minRev = Long.MAX_VALUE;
|
||||
final Long firstRevision = myKnownRepositoryLocations.getFirstRevision(locationId);
|
||||
final Long lastRevision = myKnownRepositoryLocations.getLastRevision(locationId);
|
||||
|
||||
final List<List<CommittedChangeList>> split = new CollectionSplitter<CommittedChangeList>(20).split(lists);
|
||||
final Map<String, Long> knowPaths = new HashMap<String, Long>();
|
||||
for (List<CommittedChangeList> changeLists : split) {
|
||||
final Set<String> names = new HashSet<String>();
|
||||
final Set<String> paths = new HashSet<String>();
|
||||
for (CommittedChangeList list : changeLists) {
|
||||
for (Iterator<CommittedChangeList> iterator = changeLists.iterator(); iterator.hasNext(); ) {
|
||||
final CommittedChangeList list = iterator.next();
|
||||
if (lastRevision != null && list.getNumber() <= lastRevision && list.getNumber() >= firstRevision) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
maxRev = Math.max(maxRev, list.getNumber());
|
||||
minRev = Math.min(minRev, list.getNumber());
|
||||
|
||||
@@ -281,11 +295,9 @@ public class VcsSqliteLayer {
|
||||
checkAndAddPaths(paths, knowPaths, locationId);
|
||||
insertChangeListsIfNotExists(vcs, knownAuthors, changeLists, locationId, knowPaths);
|
||||
|
||||
final Long firstRevision = myKnownRepositoryLocations.getFirstRevision(locationId);
|
||||
if (firstRevision == null || minRev < firstRevision) {
|
||||
myKnownRepositoryLocations.setFirstRevision(locationId, minRev);
|
||||
}
|
||||
final Long lastRevision = myKnownRepositoryLocations.getLastRevision(locationId);
|
||||
if (lastRevision == null || maxRev > lastRevision) {
|
||||
myKnownRepositoryLocations.setLastRevision(locationId, maxRev);
|
||||
}
|
||||
@@ -310,11 +322,8 @@ public class VcsSqliteLayer {
|
||||
final CachingCommittedChangesProvider provider = (CachingCommittedChangesProvider)vcs.getCommittedChangesProvider();
|
||||
try {
|
||||
statement.setLong(1, locationId);
|
||||
final Long lastRevision = myKnownRepositoryLocations.getLastRevision(locationId);
|
||||
final Long firstRevision = myKnownRepositoryLocations.getFirstRevision(locationId);
|
||||
|
||||
for (CommittedChangeList list : lists) {
|
||||
if (lastRevision != null && list.getNumber() <= lastRevision && list.getNumber() >= firstRevision) continue;
|
||||
statement.setLong(2, authors.get(list.getCommitterName()));
|
||||
statement.setLong(3, list.getCommitDate().getTime());
|
||||
statement.setLong(4, list.getNumber());
|
||||
@@ -370,6 +379,10 @@ public class VcsSqliteLayer {
|
||||
insert.setLong(4, beforeId);
|
||||
insert.setLong(3, type.getCode());
|
||||
SqliteUtil.insert(insert);
|
||||
} else if (change.getAfterRevision() == null) {
|
||||
insert.setLong(1, paths.get(FileUtil.toSystemIndependentName(change.getBeforeRevision().getFile().getPath())));
|
||||
insert.setLong(3, type.getCode());
|
||||
SqliteUtil.insert(insert);
|
||||
} else {
|
||||
// only after
|
||||
insert.setLong(1, paths.get(FileUtil.toSystemIndependentName(change.getAfterRevision().getFile().getPath())));
|
||||
@@ -560,4 +573,70 @@ public class VcsSqliteLayer {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public PathState getPathState(final AbstractVcs vcs, final RepositoryLocation location, final String path) throws VcsException {
|
||||
final String normalizedPath = FileUtil.toSystemIndependentName(path);
|
||||
final String normalizedLocation = FileUtil.toSystemIndependentName(location.toPresentableString());
|
||||
if (! myKnownRepositoryLocations.exists(vcs.getName(), normalizedLocation)) return null;
|
||||
|
||||
final PreparedStatement maxStatement = myConnection.getOrCreatePreparedStatement(SqliteTables.PREPARED_SELECT_PATH_DATA,
|
||||
new ThrowableConvertor<Connection, PreparedStatement, SQLException>() {
|
||||
@Override
|
||||
public PreparedStatement convert(Connection connection) throws SQLException {
|
||||
return connection.prepareStatement("SELECT MAX(R." + SqliteTables.REVISION.NUMBER_INT + ") MAX, MAX(P."+ SqliteTables.PATHS.ID +
|
||||
") PATH_ID FROM " + SqliteTables.PATHS_2_REVS.TABLE_NAME + " PR INNER JOIN " +
|
||||
SqliteTables.REVISION.TABLE_NAME + " R, " + SqliteTables.PATHS.TABLE_NAME + " P ON PR." + SqliteTables.PATHS_2_REVS.REVISION_FK + "=R." +
|
||||
SqliteTables.REVISION.ID + " AND PR." + SqliteTables.PATHS_2_REVS.PATH_FK + "=P." + SqliteTables.PATHS.ID +
|
||||
" WHERE P." + SqliteTables.PATHS.PATH + "=? AND R." + SqliteTables.REVISION.ROOT_FK + "=?");
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
maxStatement.setString(1, normalizedPath);
|
||||
final long locationId = myKnownRepositoryLocations.getLocationId(vcs.getName(), normalizedLocation);
|
||||
maxStatement.setLong(2, locationId);
|
||||
final long pathId[] = new long[1];
|
||||
final long maxRev[] = new long[1];
|
||||
maxRev[0] = -1;
|
||||
final ResultSet set = maxStatement.executeQuery();
|
||||
SqliteUtil.readSelectResults(set, new ThrowableRunnable<SQLException>() {
|
||||
@Override
|
||||
public void run() throws SQLException {
|
||||
maxRev[0] = set.getLong("MAX");
|
||||
pathId[0] = set.getLong("PATH_ID");
|
||||
}
|
||||
});
|
||||
|
||||
if (maxRev[0] == -1) return null;
|
||||
|
||||
final PreparedStatement lastChangeType = myConnection.getOrCreatePreparedStatement(SqliteTables.PREPARED_PATHS_2_REVS,
|
||||
new ThrowableConvertor<Connection, PreparedStatement, SQLException>() {
|
||||
@Override
|
||||
public PreparedStatement convert(Connection connection) throws SQLException {
|
||||
return connection.prepareStatement("SELECT PR." + SqliteTables.PATHS_2_REVS.TYPE + " FROM " + SqliteTables.PATHS_2_REVS.TABLE_NAME +
|
||||
" PR INNER JOIN " + SqliteTables.REVISION.TABLE_NAME + " R ON PR." + SqliteTables.PATHS_2_REVS.REVISION_FK + "=R." +
|
||||
SqliteTables.REVISION.ID + " WHERE R." + SqliteTables.REVISION.NUMBER_INT + "=? AND PR." + SqliteTables.PATHS_2_REVS.PATH_FK +
|
||||
"=?");
|
||||
}
|
||||
});
|
||||
lastChangeType.setLong(1, maxRev[0]);
|
||||
lastChangeType.setLong(2, pathId[0]);
|
||||
final ResultSet typeSet = lastChangeType.executeQuery();
|
||||
final long[] type = new long[1];
|
||||
type[0] = -100;
|
||||
SqliteUtil.readSelectResults(typeSet, new ThrowableRunnable<SQLException>() {
|
||||
@Override
|
||||
public void run() throws SQLException {
|
||||
type[0] = typeSet.getLong(1);
|
||||
}
|
||||
});
|
||||
if (type[0] == -100) return null;
|
||||
final ChangeTypeEnum changeType = ChangeTypeEnum.getChangeType(type[0]);
|
||||
if (changeType == null) return null;
|
||||
return new PathState(maxRev[0], ! ChangeTypeEnum.DELETE.equals(changeType));
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw new VcsException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||