mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
+7
-1
@@ -95,7 +95,11 @@ public class ProjectWizardStepFactoryImpl extends ProjectWizardStepFactory {
|
||||
}
|
||||
|
||||
public ModuleWizardStep createProjectJdkStep(final WizardContext wizardContext) {
|
||||
return new ProjectJdkStep(wizardContext){
|
||||
ModuleWizardStep projectSdkStep = wizardContext.getProjectSdkStep();
|
||||
if (projectSdkStep instanceof ProjectJdkStep) {
|
||||
return projectSdkStep;
|
||||
}
|
||||
projectSdkStep = new ProjectJdkStep(wizardContext) {
|
||||
public boolean isStepVisible() {
|
||||
final Sdk newProjectJdk = AddModuleWizard.getNewProjectJdk(wizardContext);
|
||||
if (newProjectJdk == null) return true;
|
||||
@@ -103,6 +107,8 @@ public class ProjectWizardStepFactoryImpl extends ProjectWizardStepFactory {
|
||||
return projectBuilder != null && !projectBuilder.isSuitableSdk(newProjectJdk);
|
||||
}
|
||||
};
|
||||
wizardContext.setProjectSdkStep(projectSdkStep);
|
||||
return projectSdkStep;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -179,6 +179,9 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
|
||||
@NotNull
|
||||
public Collection<RefMethod> getSuperMethods() {
|
||||
if (mySuperMethods == null) return EMPTY_METHOD_LIST;
|
||||
if (mySuperMethods.size() > 10) {
|
||||
LOG.info("method: " + getName() + " owner:" + getOwnerClass().getQualifiedName());
|
||||
}
|
||||
return mySuperMethods;
|
||||
}
|
||||
|
||||
@@ -216,7 +219,7 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
|
||||
}
|
||||
|
||||
public void addSuperMethod(RefMethodImpl refSuperMethod) {
|
||||
if (!getSuperMethods().contains(refSuperMethod)) {
|
||||
if (!getSuperMethods().contains(refSuperMethod) && !refSuperMethod.getSuperMethods().contains(this)) {
|
||||
if (mySuperMethods == null){
|
||||
mySuperMethods = new ArrayList<RefMethod>(1);
|
||||
}
|
||||
@@ -225,7 +228,7 @@ public class RefMethodImpl extends RefJavaElementImpl implements RefMethod {
|
||||
}
|
||||
|
||||
public void markExtended(RefMethodImpl method) {
|
||||
if (!getDerivedMethods().contains(method)) {
|
||||
if (!getDerivedMethods().contains(method) && !method.getDerivedMethods().contains(this)) {
|
||||
if (myDerivedMethods == null) {
|
||||
myDerivedMethods = new ArrayList<RefMethod>(1);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ public class WizardContext {
|
||||
private final List<Listener> myListeners = new ArrayList<Listener>();
|
||||
private StorageScheme myProjectStorageFormat = StorageScheme.DEFAULT;
|
||||
|
||||
private ModuleWizardStep myProjectSdkStep;
|
||||
|
||||
public void setProjectStorageFormat(StorageScheme format) {
|
||||
myProjectStorageFormat = format;
|
||||
}
|
||||
@@ -65,6 +67,14 @@ public class WizardContext {
|
||||
return myProject;
|
||||
}
|
||||
|
||||
public ModuleWizardStep getProjectSdkStep() {
|
||||
return myProjectSdkStep;
|
||||
}
|
||||
|
||||
public void setProjectSdkStep(ModuleWizardStep projectSdkStep) {
|
||||
myProjectSdkStep = projectSdkStep;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getProjectFileDirectory() {
|
||||
if (myProjectFileDirectory != null) {
|
||||
|
||||
+1
-5
@@ -109,11 +109,7 @@ public class ImplementationViewComponent extends JPanel {
|
||||
return presentableName;
|
||||
}
|
||||
|
||||
if (UISettings.getInstance().HIDE_KNOWN_EXTENSION_IN_TABS) {
|
||||
if (Comparing.strEqual(presentableName, myElementPresentation)) {
|
||||
return presentableName;
|
||||
}
|
||||
} else if (Comparing.strEqual(presentableName, myElementPresentation + "." + vFile.getExtension())){
|
||||
if (Comparing.strEqual(vFile.getName(), myElementPresentation + "." + vFile.getExtension())){
|
||||
return presentableName;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.FileContentUtil;
|
||||
import com.intellij.util.containers.ConcurrentFactoryMap;
|
||||
import com.intellij.util.containers.ConcurrentHashMap;
|
||||
import com.intellij.util.containers.ConcurrentSoftValueHashMap;
|
||||
import com.intellij.util.containers.ConcurrentWeakValueHashMap;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import gnu.trove.THashMap;
|
||||
@@ -74,7 +74,7 @@ public class FileManagerImpl implements FileManager {
|
||||
private final ProjectRootManager myProjectRootManager;
|
||||
private ProjectFileIndex myProjectFileIndex = null;
|
||||
|
||||
private final ConcurrentMap<VirtualFile, PsiDirectory> myVFileToPsiDirMap = new ConcurrentHashMap<VirtualFile, PsiDirectory>();
|
||||
private final ConcurrentMap<VirtualFile, PsiDirectory> myVFileToPsiDirMap = new ConcurrentSoftValueHashMap<VirtualFile, PsiDirectory>();
|
||||
private final ConcurrentWeakValueHashMap<VirtualFile, FileViewProvider> myVFileToViewProviderMap = new ConcurrentWeakValueHashMap<VirtualFile, FileViewProvider>();
|
||||
|
||||
private final Map<VirtualFile, GlobalSearchScope> myDefaultResolveScopesCache = new ConcurrentFactoryMap<VirtualFile, GlobalSearchScope>() {
|
||||
|
||||
@@ -306,7 +306,7 @@ public class EditorUtil {
|
||||
// hence, we need to perform special calculations to get know that.
|
||||
EditorEx editorImpl = (EditorEx)editor;
|
||||
int offset = start;
|
||||
IterationState state = new IterationState(editorImpl, start, end, false);
|
||||
IterationState state = new IterationState(editorImpl, offset, false);
|
||||
int fontType = state.getMergedAttributes().getFontType();
|
||||
int column = currentColumn[0];
|
||||
int spaceSize = getSpaceWidth(fontType, editorImpl);
|
||||
|
||||
@@ -929,25 +929,24 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
}
|
||||
}
|
||||
|
||||
int textLength = myDocument.getTextLength();
|
||||
LogicalPosition logicalPosition = visualToLogicalPosition(new VisualPosition(line, 0));
|
||||
int offset = logicalPositionToOffset(logicalPosition);
|
||||
int textLength = myDocument.getTextLength();
|
||||
|
||||
if (offset >= textLength) return new VisualPosition(line, EditorUtil.columnsNumber(p.x, EditorUtil.getSpaceWidth(Font.PLAIN, this)));
|
||||
|
||||
// There is a possible case that starting logical line is split by soft-wraps and it's part after the split should be drawn.
|
||||
// We mark that we're under such circumstances then.
|
||||
boolean activeSoftWrapProcessed = logicalPosition.softWrapLinesOnCurrentLogicalLine <= 0;
|
||||
boolean activeSoftWrapProcessed = true;
|
||||
if (logicalPosition.softWrapLinesOnCurrentLogicalLine > 0) {
|
||||
activeSoftWrapProcessed = false;
|
||||
}
|
||||
|
||||
int column = 0;
|
||||
int prevX = 0;
|
||||
CharSequence text = myDocument.getCharsNoThreadCheck();
|
||||
char c = ' ';
|
||||
|
||||
LogicalPosition endLogicalPosition = visualToLogicalPosition(new VisualPosition(line+1, 0));
|
||||
int endOffset = logicalPositionToOffset(endLogicalPosition);
|
||||
|
||||
IterationState state = new IterationState(this, offset, endOffset, false);
|
||||
IterationState state = new IterationState(this, offset, false);
|
||||
|
||||
int fontType = state.getMergedAttributes().getFontType();
|
||||
int spaceSize = EditorUtil.getSpaceWidth(fontType, this);
|
||||
@@ -1246,7 +1245,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
int offset = startOffset;
|
||||
CharSequence text = myDocument.getCharsNoThreadCheck();
|
||||
int textLength = myDocument.getTextLength();
|
||||
IterationState state = new IterationState(this, startOffset, startOffset + length, false);
|
||||
IterationState state = new IterationState(this, offset, false);
|
||||
int fontType = state.getMergedAttributes().getFontType();
|
||||
int spaceSize = EditorUtil.getSpaceWidth(fontType, this);
|
||||
|
||||
@@ -1810,9 +1809,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
int visibleLineNumber = clip.y / lineHeight;
|
||||
|
||||
VisualPosition visualPosition = xyToVisualPosition(new Point(0, clip.y));
|
||||
VisualPosition endVisualPosition = xyToVisualPosition(new Point(0, clip.y+clip.height));
|
||||
LogicalPosition logicalPosition = visualToLogicalPosition(visualPosition);
|
||||
LogicalPosition endLogicalPosition = visualToLogicalPosition(endVisualPosition);
|
||||
|
||||
Point position = new Point(0, visibleLineNumber * lineHeight);
|
||||
if (visualPosition.line == 0 && myPrefixText != null) {
|
||||
@@ -1830,10 +1827,9 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
|
||||
boolean locateBeforeSoftWrap = !SoftWrapHelper.isCaretAfterSoftWrap(this);
|
||||
int start = logicalPositionToOffset(logicalPosition);
|
||||
int end = logicalPositionToOffset(endLogicalPosition);
|
||||
getSoftWrapModel().registerSoftWrapsIfNecessary();
|
||||
|
||||
IterationState iterationState = new IterationState(this, start, end, paintSelection());
|
||||
IterationState iterationState = new IterationState(this, start, paintSelection());
|
||||
|
||||
LineIterator lIterator = createLineIterator();
|
||||
lIterator.start(start);
|
||||
@@ -2262,10 +2258,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
// position is expected to be set to null as an indication that no soft wrap-introduced visual lines should be skipped on
|
||||
// current painting iteration.
|
||||
Ref<LogicalPosition> logicalPosition = new Ref<LogicalPosition>(xyToLogicalPosition(new Point(0, clip.y)));
|
||||
LogicalPosition endLogicalPosition = xyToLogicalPosition(new Point(0, clip.y + clip.height));
|
||||
int startLineNumber = logicalPosition.get().line;
|
||||
int start = logicalPositionToOffset(logicalPosition.get());
|
||||
int end = logicalPositionToOffset(endLogicalPosition);
|
||||
|
||||
Point position = new Point(0, visibleLineNumber * lineHeight);
|
||||
if (startLineNumber == 0 && myPrefixText != null) {
|
||||
@@ -2278,7 +2272,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
return;
|
||||
}
|
||||
|
||||
IterationState iterationState = new IterationState(this, start, end, paintSelection());
|
||||
IterationState iterationState = new IterationState(this, start, paintSelection());
|
||||
LineIterator lIterator = createLineIterator();
|
||||
lIterator.start(start);
|
||||
if (lIterator.atEnd()) {
|
||||
@@ -2336,8 +2330,14 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
|
||||
}
|
||||
else {
|
||||
position.x = drawStringWithSoftWraps(g, chars, start, Math.min(hEnd, lEnd - lIterator.getSeparatorLength()) , position, clip,
|
||||
effectColor, effectType, fontType, currentColor, logicalPosition);
|
||||
if (hEnd > lEnd - lIterator.getSeparatorLength()) {
|
||||
position.x = drawStringWithSoftWraps(g, chars, start, lEnd - lIterator.getSeparatorLength(), position, clip,
|
||||
effectColor, effectType, fontType, currentColor, logicalPosition);
|
||||
}
|
||||
else {
|
||||
position.x = drawStringWithSoftWraps(g, chars, start, hEnd, position, clip, effectColor, effectType, fontType,
|
||||
currentColor, logicalPosition);
|
||||
}
|
||||
}
|
||||
|
||||
iterationState.advance();
|
||||
@@ -3054,11 +3054,11 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
}
|
||||
|
||||
int start = myDocument.getLineStartOffset(pos.line);
|
||||
if (pos.column == 0) return start;
|
||||
int end = myDocument.getLineEndOffset(pos.line);
|
||||
|
||||
CharSequence text = myDocument.getCharsNoThreadCheck();
|
||||
|
||||
if (pos.column == 0) return start;
|
||||
return EditorUtil.calcOffset(this, text, start, end, pos.column, EditorUtil.getTabSize(this));
|
||||
}
|
||||
|
||||
@@ -5518,7 +5518,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
}
|
||||
|
||||
final CharSequence text = myDocument.getCharsNoThreadCheck();
|
||||
int documentLength = myDocument.getTextLength();
|
||||
int end = myDocument.getTextLength();
|
||||
int x = 0;
|
||||
boolean lastLineLengthCalculated = false;
|
||||
final int fontSize = myScheme.getEditorFontSize();
|
||||
@@ -5548,19 +5548,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
}
|
||||
}
|
||||
|
||||
int endLine;
|
||||
for (endLine=line+1; endLine<lineCount;endLine++) {
|
||||
if (myLineWidths.getQuick(endLine) != -1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
int endOffset = endLine==lineCount ? documentLength : myDocument.getLineEndOffset(endLine);
|
||||
IterationState state = new IterationState(EditorImpl.this, offset, endOffset, false);
|
||||
IterationState state = new IterationState(EditorImpl.this, offset, false);
|
||||
int fontType = state.getMergedAttributes().getFontType();
|
||||
|
||||
int maxPreviousSoftWrappedWidth = -1;
|
||||
|
||||
while (offset < documentLength && line < lineCount) {
|
||||
while (offset < end && line < lineCount) {
|
||||
char c = text.charAt(offset);
|
||||
if (offset >= state.getEndOffset()) {
|
||||
state.advance();
|
||||
@@ -5662,7 +5655,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
}
|
||||
|
||||
public int calcColumnNumber(CharSequence text, int start, int offset, int tabSize) {
|
||||
IterationState state = new IterationState(this, start, start+offset, false);
|
||||
IterationState state = new IterationState(this, start, false);
|
||||
int fontType = state.getMergedAttributes().getFontType();
|
||||
int column = 0;
|
||||
int x = 0;
|
||||
|
||||
@@ -73,14 +73,11 @@ public final class IterationState {
|
||||
private final EditorEx myEditor;
|
||||
private final Color myReadOnlyColor;
|
||||
|
||||
public IterationState(@NotNull EditorEx editor, int start, boolean useCaretAndSelection) {
|
||||
this(editor, start, editor.getDocument().getTextLength(), useCaretAndSelection);
|
||||
}
|
||||
public IterationState(@NotNull EditorEx editor, int start, int end, boolean useCaretAndSelection) {
|
||||
public IterationState(EditorEx editor, int start, boolean useCaretAndSelection) {
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
myDocument = (DocumentEx)editor.getDocument();
|
||||
myStartOffset = start;
|
||||
myEnd = end;
|
||||
myEnd = editor.getDocument().getTextLength();
|
||||
myEditor = editor;
|
||||
|
||||
LOG.assertTrue(myStartOffset <= myEnd);
|
||||
@@ -108,10 +105,10 @@ public final class IterationState {
|
||||
myCurrentHighlighters = new ArrayList<RangeHighlighterEx>();
|
||||
|
||||
MarkupModelEx editorMarkup = (MarkupModelEx)editor.getMarkupModel();
|
||||
myView.init(editorMarkup, start, myEnd);
|
||||
myView.init(editorMarkup, start);
|
||||
|
||||
final MarkupModelEx docMarkup = (MarkupModelEx)editor.getDocument().getMarkupModel(editor.getProject());
|
||||
myDoc.init(docMarkup, start, myEnd);
|
||||
myDoc.init(docMarkup, start);
|
||||
|
||||
myEndOffset = myStartOffset;
|
||||
|
||||
@@ -122,8 +119,8 @@ public final class IterationState {
|
||||
private RangeHighlighterEx myNextHighlighter = null;
|
||||
private Iterator<RangeHighlighterEx> myIterator;
|
||||
|
||||
private void init(@NotNull MarkupModelEx markupModel, int start, int end) {
|
||||
myIterator = markupModel.overlappingIterator(start, end);
|
||||
private void init(MarkupModelEx markupModel, int start) {
|
||||
myIterator = markupModel.overlappingIterator(start, myDocument.getTextLength());
|
||||
int skipped = 0;
|
||||
while (myIterator.hasNext()) {
|
||||
RangeHighlighterEx highlighter = myIterator.next();
|
||||
@@ -133,10 +130,7 @@ public final class IterationState {
|
||||
}
|
||||
skipped++;
|
||||
}
|
||||
if (skipped > Math.min(1000, markupModel.getDocument().getTextLength())) {
|
||||
int i = 0;
|
||||
//LOG.error("Inefficient iteration, use 'new IterationState(start, end)' constructor to limit the number of highlighters to iterate");
|
||||
}
|
||||
int i = skipped;
|
||||
}
|
||||
|
||||
private void advance() {
|
||||
|
||||
@@ -38,19 +38,14 @@ public final class ConcurrentSoftValueHashMap<K,V> implements ConcurrentMap<K,V>
|
||||
}
|
||||
|
||||
private void processQueue() {
|
||||
//int count = 0;
|
||||
while(true){
|
||||
MyReference<K,V> ref = (MyReference<K,V>)myQueue.poll();
|
||||
if (ref == null) {
|
||||
//if (count > 0){
|
||||
// System.out.println("SoftValueHashMap: " + count + " references have been collected");
|
||||
//}
|
||||
return;
|
||||
}
|
||||
if (myMap.get(ref.key) == ref){
|
||||
myMap.remove(ref.key);
|
||||
}
|
||||
//count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +98,64 @@ public final class ConcurrentSoftValueHashMap<K,V> implements ConcurrentMap<K,V>
|
||||
}
|
||||
|
||||
public Set<Entry<K, V>> entrySet() {
|
||||
throw new RuntimeException("method not implemented");
|
||||
return new AbstractSet<Entry<K, V>>() {
|
||||
@Override
|
||||
public Iterator<Entry<K, V>> iterator() {
|
||||
final Iterator<Entry<K,MyReference<K, V>>> refEntries = myMap.entrySet().iterator();
|
||||
return new Iterator<Entry<K, V>>() {
|
||||
Entry<K, V> next;
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
while (next == null) {
|
||||
if (!refEntries.hasNext()) return false;
|
||||
Entry<K, MyReference<K, V>> ref = refEntries.next();
|
||||
final K k = ref.getKey();
|
||||
V v = ref.getValue().get();
|
||||
next = v == null ? null : new AbstractMap.SimpleEntry<K, V>(k,v){
|
||||
@Override
|
||||
public V setValue(V value) {
|
||||
V old = super.setValue(value);
|
||||
put(k, value);
|
||||
return old;
|
||||
}
|
||||
};
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entry<K, V> next() {
|
||||
if (!hasNext()) throw new NoSuchElementException();
|
||||
Entry<K, V> r = next;
|
||||
next = null;
|
||||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (next == null) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
ConcurrentSoftValueHashMap.this.remove(next.getKey());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return myMap.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return ConcurrentSoftValueHashMap.this.remove(((Entry)o).getKey()) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
ConcurrentSoftValueHashMap.this.clear();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public V putIfAbsent(final K key, final V value) {
|
||||
@@ -145,10 +197,10 @@ public final class ConcurrentSoftValueHashMap<K,V> implements ConcurrentMap<K,V>
|
||||
}
|
||||
|
||||
public void putAll(Map<? extends K, ? extends V> t) {
|
||||
for (K k : t.keySet()) {
|
||||
V v = t.get(k);
|
||||
for (Entry<? extends K, ? extends V> entry : t.entrySet()) {
|
||||
V v = entry.getValue();
|
||||
if (v != null) {
|
||||
put(k, v);
|
||||
put(entry.getKey(), v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user