diff --git a/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java b/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java index 9b683b53ab65..22fa38db97fb 100644 --- a/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java +++ b/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java @@ -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(); 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); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java index 215b80e89064..b3de08e25172 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java @@ -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(); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java index 884c59cc082c..083ea16e5091 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java @@ -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"); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index a260439b1c18..895cd2e2ce75 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -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 myBackStack = new Stack(); private final Stack myForwardStack = new Stack(); @@ -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 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) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java index c5de46f9332a..d1bbdf28bf32 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java @@ -395,7 +395,8 @@ public class DocumentationManager extends DockablePopupManager 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()); - } -} +} \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java new file mode 100644 index 000000000000..b079afcddcd1 --- /dev/null +++ b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java @@ -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 EP_NAME = ExtensionPointName.create("com.jetbrains.fileUrlMapper"); + + @NotNull + public abstract List 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 map, @NotNull Project project); + } +} \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java index 4bfce6088d09..f1c899be3e04 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java @@ -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())); } } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 817b2105d1da..0b958006e33a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -1631,6 +1631,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return infos; } catch (ProcessCanceledException e) { + PsiDocumentManager.getInstance(project).commitAllDocuments(); + UIUtil.dispatchAllInvocationEvents(); exception = e; } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java index c11e8f5547cb..fd68ef40752c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java @@ -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); diff --git a/plugins/eclipse/eclipse.iml b/plugins/eclipse/eclipse.iml index 30486e5f0e57..c75f9703346e 100644 --- a/plugins/eclipse/eclipse.iml +++ b/plugins/eclipse/eclipse.iml @@ -3,9 +3,10 @@ - + + @@ -22,5 +23,4 @@ - - + \ No newline at end of file diff --git a/plugins/eclipse/gen/icons/EclipseIcons.java b/plugins/eclipse/gen/icons/EclipseIcons.java new file mode 100644 index 000000000000..891304281e9e --- /dev/null +++ b/plugins/eclipse/gen/icons/EclipseIcons.java @@ -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 +} diff --git a/plugins/eclipse/resources/icons/EclipseIcons.java b/plugins/eclipse/resources/icons/EclipseIcons.java deleted file mode 100644 index ab91ce0e357b..000000000000 --- a/plugins/eclipse/resources/icons/EclipseIcons.java +++ /dev/null @@ -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 -} diff --git a/plugins/eclipse/resources/icons/eclipse.png b/plugins/eclipse/resources/icons/eclipse.png new file mode 100644 index 000000000000..decb2e419889 Binary files /dev/null and b/plugins/eclipse/resources/icons/eclipse.png differ diff --git a/plugins/eclipse/resources/icons/eclipse@2x.png b/plugins/eclipse/resources/icons/eclipse@2x.png new file mode 100644 index 000000000000..3d636e1cbbcb Binary files /dev/null and b/plugins/eclipse/resources/icons/eclipse@2x.png differ diff --git a/plugins/eclipse/resources/icons/eclipse@2x_dark.png b/plugins/eclipse/resources/icons/eclipse@2x_dark.png new file mode 100644 index 000000000000..69c2860063de Binary files /dev/null and b/plugins/eclipse/resources/icons/eclipse@2x_dark.png differ diff --git a/plugins/eclipse/resources/icons/eclipse_dark.png b/plugins/eclipse/resources/icons/eclipse_dark.png new file mode 100644 index 000000000000..67979cc0a13b Binary files /dev/null and b/plugins/eclipse/resources/icons/eclipse_dark.png differ diff --git a/plugins/eclipse/resources/images/eclipse.gif b/plugins/eclipse/resources/images/eclipse.gif deleted file mode 100644 index eb7b90c76711..000000000000 Binary files a/plugins/eclipse/resources/images/eclipse.gif and /dev/null differ