mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -17,7 +17,9 @@ package org.jetbrains.ide;
|
||||
|
||||
import com.intellij.ide.XmlRpcHandlerBean;
|
||||
import com.intellij.ide.XmlRpcServer;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
@@ -48,7 +50,7 @@ public class XmlRpcServerImpl implements XmlRpcServer {
|
||||
handlerMapping = new THashMap<String, Object>();
|
||||
for (XmlRpcHandlerBean handlerBean : Extensions.getExtensions(XmlRpcHandlerBean.EP_NAME)) {
|
||||
try {
|
||||
handlerMapping.put(handlerBean.name, handlerBean.instantiate());
|
||||
handlerMapping.put(handlerBean.name, AbstractExtensionPointBean.instantiate(handlerBean.findClass(handlerBean.implementation), ApplicationManager.getApplication().getPicoContainer(), true));
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
LOG.error(e);
|
||||
|
||||
-6
@@ -42,7 +42,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.RangeMarker;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.ex.RangeHighlighterEx;
|
||||
import com.intellij.openapi.editor.impl.DocumentMarkupModel;
|
||||
import com.intellij.openapi.editor.markup.MarkupModel;
|
||||
@@ -125,7 +124,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers
|
||||
@NotNull DaemonCodeAnalyzerSettings daemonCodeAnalyzerSettings,
|
||||
@NotNull EditorTracker editorTracker,
|
||||
@NotNull PsiDocumentManager psiDocumentManager,
|
||||
@NotNull EditorColorsManager colorsManager,
|
||||
@SuppressWarnings("UnusedParameters") @NotNull final NamedScopeManager namedScopeManager,
|
||||
@SuppressWarnings("UnusedParameters") @NotNull final DependencyValidationManager dependencyValidationManager) {
|
||||
myProject = project;
|
||||
@@ -305,7 +303,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
|
||||
Project project = file.getProject();
|
||||
setUpdateByTimerEnabled(false);
|
||||
FileStatusMap.getAndClearLog();
|
||||
FileStatusMap fileStatusMap = getFileStatusMap();
|
||||
fileStatusMap.allowDirt(canChangeDocument);
|
||||
@@ -367,9 +364,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers
|
||||
|
||||
@TestOnly
|
||||
public void prepareForTest() {
|
||||
//if (!myInitialized) {
|
||||
// projectOpened();
|
||||
//}
|
||||
setUpdateByTimerEnabled(false);
|
||||
waitForTermination();
|
||||
}
|
||||
|
||||
@@ -363,6 +363,7 @@ public class DaemonListeners implements Disposable {
|
||||
|
||||
static boolean isUnderIgnoredAction(@Nullable Object action) {
|
||||
return action instanceof DocumentRunnable.IgnoreDocumentRunnable ||
|
||||
action == DocumentRunnable.IgnoreDocumentRunnable.class ||
|
||||
ApplicationManager.getApplication().hasWriteAction(DocumentRunnable.IgnoreDocumentRunnable.class);
|
||||
}
|
||||
|
||||
@@ -428,15 +429,13 @@ public class DaemonListeners implements Disposable {
|
||||
@Override
|
||||
public void beforeWriteActionStart(Object action) {
|
||||
myDaemonWasRunning = myDaemonCodeAnalyzer.isRunning();
|
||||
if (!myDaemonWasRunning) return; // we'll restart in writeActionFinished()
|
||||
if (!myDaemonWasRunning || isUnderIgnoredAction(action)) return; // we'll restart in writeActionFinished()
|
||||
stopDaemon(true, "Write action start");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeActionFinished(Object action) {
|
||||
if (myDaemonWasRunning) {
|
||||
stopDaemon(true, "Write action finish");
|
||||
}
|
||||
stopDaemon(true, "Write action finish");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-2
@@ -48,6 +48,7 @@ import com.intellij.pom.Navigatable;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.SmartPointerManager;
|
||||
import com.intellij.psi.SmartPsiElementPointer;
|
||||
import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.SideBorder;
|
||||
@@ -94,6 +95,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
|
||||
private DocumentationManager myManager;
|
||||
private SmartPsiElementPointer myElement;
|
||||
private long myModificationCount;
|
||||
|
||||
private final Stack<Context> myBackStack = new Stack<Context>();
|
||||
private final Stack<Context> myForwardStack = new Stack<Context>();
|
||||
@@ -485,6 +487,19 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
return myElement != null ? myElement.getElement() : null;
|
||||
}
|
||||
|
||||
private void setElement(SmartPsiElementPointer element) {
|
||||
myElement = element;
|
||||
myModificationCount = getCurrentModificationCount();
|
||||
}
|
||||
|
||||
public boolean isUpToDate() {
|
||||
return getElement() != null && myModificationCount == getCurrentModificationCount();
|
||||
}
|
||||
|
||||
private long getCurrentModificationCount() {
|
||||
return myElement != null ? PsiModificationTracker.SERVICE.getInstance(myElement.getProject()).getModificationCount() : -1;
|
||||
}
|
||||
|
||||
public void setNavigateCallback(Consumer<PsiElement> navigateCallback) {
|
||||
myNavigateCallback = navigateCallback;
|
||||
}
|
||||
@@ -531,7 +546,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
: null;
|
||||
|
||||
if (element != null) {
|
||||
myElement = element;
|
||||
setElement(element);
|
||||
}
|
||||
|
||||
myIsEmpty = false;
|
||||
@@ -546,7 +561,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr
|
||||
}
|
||||
|
||||
private void setDataInternal(SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) {
|
||||
myElement = element;
|
||||
setElement(element);
|
||||
|
||||
boolean justShown = false;
|
||||
if (!myIsShown && myHint != null) {
|
||||
|
||||
+3
-2
@@ -395,7 +395,8 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
Content content = myToolWindow.getContentManager().getSelectedContent();
|
||||
if (content != null) {
|
||||
DocumentationComponent component = (DocumentationComponent)content.getComponent();
|
||||
if (element.getManager().areElementsEquivalent(component.getElement(), element)) {
|
||||
boolean sameElement = element.getManager().areElementsEquivalent(component.getElement(), element);
|
||||
if (sameElement) {
|
||||
JComponent preferredFocusableComponent = content.getPreferredFocusableComponent();
|
||||
// focus toolwindow on the second actionPerformed
|
||||
boolean focus = requestFocus || CommandProcessor.getInstance().getCurrentCommand() != null;
|
||||
@@ -403,7 +404,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
IdeFocusManager.getInstance(myProject).requestFocus(preferredFocusableComponent, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!sameElement || !component.isUpToDate()) {
|
||||
content.setDisplayName(getTitle(element, true));
|
||||
fetchDocInfo(getDefaultCollector(element, originalElement), component, true);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -15,14 +15,10 @@
|
||||
*/
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class XmlRpcHandlerBean extends AbstractExtensionPointBean {
|
||||
public static final ExtensionPointName<XmlRpcHandlerBean> EP_NAME = ExtensionPointName.create("com.intellij.xmlRpcHandler");
|
||||
|
||||
@@ -31,8 +27,4 @@ public class XmlRpcHandlerBean extends AbstractExtensionPointBean {
|
||||
|
||||
@Attribute("implementation")
|
||||
public String implementation;
|
||||
|
||||
public Object instantiate() throws ClassNotFoundException {
|
||||
return instantiate(implementation, ApplicationManager.getApplication().getPicoContainer());
|
||||
}
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.jetbrains.javascript.debugger;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.util.Url;
|
||||
import com.intellij.util.containers.ObjectIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class FileUrlMapper {
|
||||
public static final ExtensionPointName<FileUrlMapper> EP_NAME = ExtensionPointName.create("com.jetbrains.fileUrlMapper");
|
||||
|
||||
@NotNull
|
||||
public abstract List<Url> getUrls(@NotNull VirtualFile file, @NotNull Project project, @Nullable String currentAuthority);
|
||||
|
||||
/**
|
||||
* Optional to implement, useful if default navigation position to source file is not equals to 0:0 (java file for example)
|
||||
*/
|
||||
@Nullable
|
||||
public Navigatable getNavigatable(@NotNull Url url, @NotNull Project project, @Nullable Url requestor) {
|
||||
VirtualFile file = getFile(url, project, requestor);
|
||||
return file == null ? null : new OpenFileDescriptor(project, file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract VirtualFile getFile(@NotNull Url url, @NotNull Project project, @Nullable Url requestor);
|
||||
|
||||
/**
|
||||
* Optional to implement, sometimes you cannot build URL, but can match.
|
||||
* Lifetime: resolve session lifetime. Could be called multiple times: n <= total sourcemap count
|
||||
*/
|
||||
@Nullable
|
||||
public SourceResolver createSourceResolver(@NotNull VirtualFile file, @NotNull Project project) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FileType getFileType(@NotNull Url url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static abstract class SourceResolver {
|
||||
/**
|
||||
* Return -1 if no match
|
||||
*/
|
||||
public abstract int resolve(@NotNull ObjectIntHashMap<Url> map, @NotNull Project project);
|
||||
}
|
||||
}
|
||||
@@ -2,42 +2,38 @@ package org.jetbrains.debugger;
|
||||
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.intellij.xdebugger.XSourcePositionWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SourceInfo extends XSourcePositionWrapper {
|
||||
public class SourceInfo implements XSourcePosition {
|
||||
private final String functionName;
|
||||
|
||||
private final VirtualFile file;
|
||||
private final int line;
|
||||
private final int column;
|
||||
|
||||
private int offset = -1;
|
||||
|
||||
private SourceInfo(@Nullable String functionName, @NotNull VirtualFile file, int line, int column) {
|
||||
this.functionName = functionName;
|
||||
this.file = file;
|
||||
this.line = line;
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static SourceInfo create(@Nullable String functionName, @Nullable VirtualFile file, int line, int column) {
|
||||
if (file == null) {
|
||||
if (file == null || !file.isValid()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
XSourcePosition position;
|
||||
AccessToken token = ReadAction.start();
|
||||
try {
|
||||
position = XDebuggerUtil.getInstance().createPosition(file, line);
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
return position == null ? null : new SourceInfo(functionName, position, column);
|
||||
}
|
||||
|
||||
private SourceInfo(@Nullable String functionName, @NotNull XSourcePosition position, int column) {
|
||||
super(position);
|
||||
|
||||
this.functionName = functionName;
|
||||
this.column = column;
|
||||
return new SourceInfo(functionName, file, line, column);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -45,18 +41,50 @@ public class SourceInfo extends XSourcePositionWrapper {
|
||||
return functionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLine() {
|
||||
return line;
|
||||
}
|
||||
|
||||
public int getColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffset() {
|
||||
if (offset == -1) {
|
||||
Document document;
|
||||
AccessToken token = ReadAction.start();
|
||||
try {
|
||||
document = file.isValid() ? FileDocumentManager.getInstance().getDocument(file) : null;
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
|
||||
if (document == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
offset = line < document.getLineCount() ? document.getLineStartOffset(line) : -1;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VirtualFile getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Navigatable createNavigatable(@NotNull Project project) {
|
||||
return new OpenFileDescriptor(project, myPosition.getFile(), myPosition.getLine(), column);
|
||||
return new OpenFileDescriptor(project, getFile(), getLine(), getColumn());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return myPosition.getFile() + ":" + myPosition.getLine() + (column == -1 ? "": (":" + getColumn()));
|
||||
return getFile() + ":" + getLine() + (column == -1 ? "": (":" + getColumn()));
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -1631,6 +1631,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
return infos;
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
exception = e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,11 +113,22 @@ public class XSourcePositionImpl implements XSourcePosition {
|
||||
@Override
|
||||
@NotNull
|
||||
public Navigatable createNavigatable(@NotNull Project project) {
|
||||
return createOpenFileDescriptor(project, this);
|
||||
return doCreateOpenFileDescriptor(project, this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static OpenFileDescriptor createOpenFileDescriptor(@NotNull Project project, @NotNull XSourcePosition position) {
|
||||
Navigatable navigatable = position.createNavigatable(project);
|
||||
if (navigatable instanceof OpenFileDescriptor) {
|
||||
return (OpenFileDescriptor)navigatable;
|
||||
}
|
||||
else {
|
||||
return doCreateOpenFileDescriptor(project, position);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static OpenFileDescriptor doCreateOpenFileDescriptor(@NotNull Project project, @NotNull XSourcePosition position) {
|
||||
return position.getOffset() != -1
|
||||
? new OpenFileDescriptor(project, position.getFile(), position.getOffset())
|
||||
: new OpenFileDescriptor(project, position.getFile(), position.getLine(), 0);
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSources" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/standalone" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
@@ -22,5 +23,4 @@
|
||||
<orderEntry type="module" module-name="eclipse-jps-plugin" />
|
||||
<orderEntry type="module" module-name="common-eclipse-util" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
@@ -0,0 +1,17 @@
|
||||
package icons;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
*/
|
||||
public class EclipseIcons {
|
||||
private static Icon load(String path) {
|
||||
return IconLoader.getIcon(path, EclipseIcons.class);
|
||||
}
|
||||
|
||||
public static final Icon Eclipse = load("/icons/eclipse.png"); // 16x16
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 icons;
|
||||
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* NOTE THIS FILE IS AUTO-GENERATED
|
||||
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
|
||||
*/
|
||||
public class EclipseIcons {
|
||||
private static Icon load(String path) {
|
||||
return IconLoader.getIcon(path, EclipseIcons.class);
|
||||
}
|
||||
|
||||
public static final Icon Eclipse = load("/images/eclipse.gif"); // 16x16
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 428 B |
Binary file not shown.
|
After Width: | Height: | Size: 751 B |
Binary file not shown.
|
After Width: | Height: | Size: 757 B |
Binary file not shown.
|
After Width: | Height: | Size: 438 B |
Binary file not shown.
|
Before Width: | Height: | Size: 308 B |
Reference in New Issue
Block a user