From 4eb7a90045b4cd31121648a21ed6131ebd61a903 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Fri, 4 May 2012 13:59:28 +0200 Subject: [PATCH 1/8] Fixed windows file references handling for raw strings (PY-6233). --- .../resolve/reference/impl/providers/FileReferenceSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java index e05486982f86..0e8c66a904ea 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java @@ -230,7 +230,7 @@ public class FileReferenceSet { if (str.equals(separatorString)) { final FileReference fileReference = - createFileReference(new TextRange(myStartInElement, myStartInElement + 1), index++, separatorString); + createFileReference(new TextRange(myStartInElement, myStartInElement + sepLen), index++, separatorString); referencesList.add(fileReference); } From ba63d106760be990b2c205f449c56463916efff0 Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Fri, 4 May 2012 18:49:17 +0400 Subject: [PATCH 2/8] Support android:id --- .../layout/relative/BaselineSnapPoint.java | 2 +- .../layout/relative/ComponentSnapPoint.java | 4 +- .../android/designer/model/IdManager.java | 93 +++++++++++++++++++ .../android/designer/model/ModelParser.java | 17 +++- .../designer/model/PropertyParser.java | 7 +- .../designer/model/RadViewComponent.java | 11 ++- .../propertyTable/AttributeProperty.java | 7 -- .../designer/propertyTable/IdProperty.java | 64 +++++++++++++ 8 files changed, 190 insertions(+), 15 deletions(-) create mode 100644 plugins/android-designer/src/com/intellij/android/designer/model/IdManager.java create mode 100644 plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/BaselineSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/BaselineSnapPoint.java index 8c58c8fb17fa..e391ca5a84e7 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/BaselineSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/BaselineSnapPoint.java @@ -74,7 +74,7 @@ public class BaselineSnapPoint extends SnapPoint { @Override public void run() { XmlTag tag = ((RadViewComponent)components.get(0)).getTag(); - tag.setAttribute("android:layout_alignBaseline", myComponent.getId()); + tag.setAttribute("android:layout_alignBaseline", myComponent.ensureId()); } }); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java index 92fc8e864394..68c64c285354 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/layout/relative/ComponentSnapPoint.java @@ -186,11 +186,11 @@ public class ComponentSnapPoint extends SnapPoint { return; } - final String componentId = myComponent.getId(); - ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { + final String componentId = myComponent.ensureId(); + for (RadComponent component : components) { XmlTag tag = ((RadViewComponent)component).getTag(); tag.setAttribute(attribute, componentId); diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/IdManager.java b/plugins/android-designer/src/com/intellij/android/designer/model/IdManager.java new file mode 100644 index 000000000000..3571b818c880 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/IdManager.java @@ -0,0 +1,93 @@ +/* + * 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.android.designer.model; + +import com.intellij.designer.model.RadComponent; +import com.intellij.designer.model.RadComponentVisitor; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.util.text.StringUtil; + +import java.util.HashSet; +import java.util.Set; + +/** + * @author Alexander Lobas + */ +public class IdManager { + public static final String KEY = "IdManager"; + + private final Set myIdList = new HashSet(); + + public static IdManager get(RadComponent component) { + return component.getRoot().getClientProperty(KEY); + } + + public void addComponent(RadViewComponent component) { + String id = component.getId(); + if (id != null) { + myIdList.add(id); + } + } + + public void removeComponent(RadViewComponent component, boolean withChildren) { + String id = component.getId(); + if (id != null) { + myIdList.remove(id); + } + + if (withChildren) { + for (RadComponent child : component.getChildren()) { + removeComponent((RadViewComponent)child, true); + } + } + } + + public String createId(RadViewComponent component) { + String id = StringUtil.decapitalize(component.getMetaModel().getTag()); + String idValue = "@id/" + id; + String nextIdValue = idValue; + int index = 0; + + while (myIdList.contains(nextIdValue)) { + nextIdValue = idValue + Integer.toString(++index); + } + + myIdList.add(nextIdValue); + String newId = "@+id/" + id + (index == 0 ? "" : Integer.toString(index)); + component.getTag().setAttribute("android:id", newId); + return newId; + } + + public void ensurePasteIds(final RadViewComponent component) { + // TODO: rename all references + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + component.accept(new RadComponentVisitor() { + @Override + public void endVisit(RadComponent component) { + RadViewComponent viewComponent = (RadViewComponent)component; + String idValue = viewComponent.getId(); + if (idValue != null && myIdList.contains(idValue)) { + createId(viewComponent); + } + } + }, true); + } + }); + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java index f7a95629d275..37e917ea0805 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java @@ -53,6 +53,8 @@ public class ModelParser extends XmlRecursiveElementVisitor { private static final int EMPTY_COMPONENT_SIZE = 5; + private final IdManager myIdManager = new IdManager(); + private final MetaManager myMetaManager; private final XmlFile myXmlFile; private RadViewComponent myRootComponent; @@ -94,6 +96,7 @@ public class ModelParser extends XmlRecursiveElementVisitor { } RadViewComponent component = createComponent(tag, metaModel); + myIdManager.addComponent(component); if (myRootComponent == null) { myRootComponent = component; @@ -176,7 +179,7 @@ public class ModelParser extends XmlRecursiveElementVisitor { public String compute() { return newComponent.getMetaModel().getCreation(); } - }); + }, true); PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY); propertyParser.load(newComponent); @@ -188,6 +191,8 @@ public class ModelParser extends XmlRecursiveElementVisitor { PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY); pasteComponent(newComponent, container.getTag(), insertBefore == null ? null : insertBefore.getTag(), propertyParser); + + IdManager.get(container).ensurePasteIds(newComponent); } private static void pasteComponent(final RadViewComponent component, @@ -231,7 +236,7 @@ public class ModelParser extends XmlRecursiveElementVisitor { return builder.append("/>").toString(); } - }); + }, false); XmlTag xmlTag = component.getTag(); List children = component.getChildren(); @@ -253,7 +258,8 @@ public class ModelParser extends XmlRecursiveElementVisitor { public static void addComponentTag(final XmlTag parentTag, final RadViewComponent component, final XmlTag nextTag, - final Computable tagBuilder) { + final Computable tagBuilder, + final boolean createId) { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { @@ -291,6 +297,10 @@ public class ModelParser extends XmlRecursiveElementVisitor { } component.setTag(xmlTag); + + if (createId) { + component.ensureId(); + } } }); } @@ -340,6 +350,7 @@ public class ModelParser extends XmlRecursiveElementVisitor { } updateRootComponent(myRootComponent, session, nativeComponent); + myRootComponent.setClientProperty(IdManager.KEY, myIdManager); } public static void updateRootComponent(RadViewComponent rootComponent, diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index 579ae1514494..08abdf217682 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -164,7 +164,12 @@ public class PropertyParser { property = new FlagProperty(name, definition); } else { - property = new AttributeProperty(name, definition); + if ("id".equals(name) && "View".equals(component)) { + property = new IdProperty(name, definition); + } + else { + property = new AttributeProperty(name, definition); + } } if (model != null) { diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java index 42d40846a5b8..2fa5a8ea9f06 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewComponent.java @@ -75,8 +75,15 @@ public class RadViewComponent extends RadVisualComponent { myMargins = null; } + public String ensureId() { + String id = getId(); + if (id == null) { + id = IdManager.get(this).createId(this); + } + return id; + } + public String getId() { - // TODO: ensure id return getId(myTag.getAttributeValue("android:id")); } @@ -123,6 +130,8 @@ public class RadViewComponent extends RadVisualComponent { @Override public void delete() throws Exception { + IdManager.get(this).removeComponent(this, true); + removeFromParent(); ApplicationManager.getApplication().runWriteAction(new Runnable() { diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java index 739bd12025c9..e10a2fa5e159 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/AttributeProperty.java @@ -19,7 +19,6 @@ import com.intellij.android.designer.model.RadViewComponent; import com.intellij.android.designer.propertyTable.editors.ResourceEditor; import com.intellij.android.designer.propertyTable.editors.StringsComboEditor; import com.intellij.android.designer.propertyTable.renderers.ResourceRenderer; -import com.intellij.designer.model.RadComponent; import com.intellij.designer.propertyTable.Property; import com.intellij.designer.propertyTable.PropertyEditor; import com.intellij.designer.propertyTable.PropertyRenderer; @@ -33,7 +32,6 @@ import org.jetbrains.android.dom.attrs.AttributeFormat; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.List; import java.util.Set; /** @@ -141,9 +139,4 @@ public class AttributeProperty extends Property { public PropertyEditor getEditor() { return myEditor; } - - @Override - public boolean availableFor(List components) { - return !"id".equals(getName()); - } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java new file mode 100644 index 000000000000..ae1958a5e8f4 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/propertyTable/IdProperty.java @@ -0,0 +1,64 @@ +/* + * 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.android.designer.propertyTable; + +import com.intellij.android.designer.model.IdManager; +import com.intellij.android.designer.model.RadViewComponent; +import com.intellij.designer.model.RadComponent; +import com.intellij.designer.propertyTable.Property; +import com.intellij.openapi.util.text.StringUtil; +import org.jetbrains.android.dom.attrs.AttributeDefinition; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +/** + * @author Alexander Lobas + */ +public class IdProperty extends AttributeProperty { + public IdProperty(@NotNull String name, @NotNull AttributeDefinition definition) { + super(name, definition); + } + + public IdProperty(@Nullable Property parent, @NotNull String name, @NotNull AttributeDefinition definition) { + super(parent, name, definition); + } + + @Override + public Property createForNewPresentation(@Nullable Property parent, @NotNull String name) { + return new IdProperty(parent, name, myDefinition); + } + + @Override + public void setValue(RadViewComponent component, Object value) throws Exception { + // TODO: rename all references + + IdManager idManager = IdManager.get(component); + idManager.removeComponent(component, false); + + super.setValue(component, value); + + if (!StringUtil.isEmpty((String)value)) { + idManager.addComponent(component); + } + } + + @Override + public boolean availableFor(List components) { + return false; + } +} \ No newline at end of file From 719c2345d07a807a63428e7a539304765087119a Mon Sep 17 00:00:00 2001 From: "andrey.zaytsev" Date: Fri, 4 May 2012 19:27:13 +0400 Subject: [PATCH 3/8] Edit Breakpoint: action text --- .../src/com/intellij/debugger/ui/JavaDebuggerSupport.java | 1 + .../src/messages/ActionsBundle.properties | 1 + platform/platform-resources/src/idea/LangActions.xml | 2 +- .../src/com/intellij/xdebugger/impl/DebuggerSupport.java | 2 +- .../src/com/intellij/xdebugger/impl/XDebuggerSupport.java | 1 + .../xdebugger/impl/actions/EditBreakpointAction.java | 5 +++++ 6 files changed, 10 insertions(+), 2 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java index 8973578351b2..6d50a9264241 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/JavaDebuggerSupport.java @@ -172,6 +172,7 @@ public class JavaDebuggerSupport extends DebuggerSupport { return context != null ? context.getDebuggerSession() : null; } + @NotNull @Override public EditBreakpointActionHandler getEditBreakpointAction() { return myEditBreakpointActionHandler; diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index 13f9c5e4c087..389e75e26a1f 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -635,6 +635,7 @@ action.ToggleBreakpointEnabled.text=Toggle _Breakpoint Enabled action.ToggleBreakpointEnabled.description=Enable/disable breakpoint at the current line action.ViewBreakpoints.text=View Brea_kpoints... action.ViewBreakpoints.description=View and manage all breakpoints and watchpoints +action.EditBreakpoint.text=Edit action.ExportThreads.text=Export T_hreads... action.ExportThreads.description=Save all threads information to a text file or clipboard action.Runner.RestoreLayout.text=Restore Layout diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index 9f344b2786b7..2d20bcfcaefb 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -627,7 +627,7 @@ icon="/debugger/showCurrentFrame.png"/> - + diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java index 8a75da2fe43e..fec2522df253 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/DebuggerSupport.java @@ -102,6 +102,6 @@ public abstract class DebuggerSupport { @Nullable public abstract AbstractDebuggerSession getCurrentSession(@NotNull Project project); - @Nullable + @NotNull public abstract EditBreakpointActionHandler getEditBreakpointAction(); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java index ff8c07440ae1..691a8a9363fb 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerSupport.java @@ -207,6 +207,7 @@ public class XDebuggerSupport extends DebuggerSupport { return XDebuggerManager.getInstance(project).getCurrentSession(); } + @NotNull @Override public EditBreakpointActionHandler getEditBreakpointAction() { return myEditBreakpointActoinHandler; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/EditBreakpointAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/EditBreakpointAction.java index 8ed5a1c81e0b..9ffd9eea4abb 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/EditBreakpointAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/EditBreakpointAction.java @@ -15,11 +15,16 @@ */ package com.intellij.xdebugger.impl.actions; +import com.intellij.idea.ActionsBundle; import com.intellij.xdebugger.impl.DebuggerSupport; import org.jetbrains.annotations.NotNull; public class EditBreakpointAction extends XDebuggerActionBase { + public EditBreakpointAction() { + getTemplatePresentation().setText(ActionsBundle.actionText("EditBreakpoint")); + } + @NotNull @Override protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) { From 4eb792e7a3423cb0d5ea5776f87484bac066a174 Mon Sep 17 00:00:00 2001 From: Dmitry Boulytchev Date: Fri, 4 May 2012 19:50:09 +0400 Subject: [PATCH 4/8] Fixed bug in .class as annotation parameter (compile-server). --- .../annotations/classAsArgument.log | 12 + .../annotations/classAsArgument/.idea/.name | 1 + .../annotations/classAsArgument/.idea/ant.xml | 7 + .../classAsArgument/.idea/compiler.xml | 21 + .../.idea/copyright/profiles_settings.xml | 5 + .../classAsArgument/.idea/encodings.xml | 5 + .../classAsArgument/.idea/misc.xml | 26 ++ .../classAsArgument/.idea/modules.xml | 9 + .../.idea/scopes/scope_settings.xml | 5 + .../classAsArgument/.idea/uiDesigner.xml | 125 +++++ .../annotations/classAsArgument/.idea/vcs.xml | 7 + .../classAsArgument/.idea/workspace.xml | 431 ++++++++++++++++++ .../annotations/classAsArgument/A.java.new | 0 .../classAsArgument/classAsArgument.iml | 12 + .../annotations/classAsArgument/src/A.java | 9 + .../annotations/classAsArgument/src/Ann.java | 13 + .../classAsArgument/src/Annotated.java | 10 + .../org/jetbrains/ether/AnnotationTest.java | 4 + .../dependencyView/ClassfileAnalyzer.java | 8 + 19 files changed, 710 insertions(+) create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument.log create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/.name create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/ant.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/compiler.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/copyright/profiles_settings.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/encodings.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/misc.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/modules.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/scopes/scope_settings.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/uiDesigner.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/vcs.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/workspace.xml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/A.java.new create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/classAsArgument.iml create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/A.java create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Ann.java create mode 100644 java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Annotated.java diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument.log b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument.log new file mode 100644 index 000000000000..a4e99b222775 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument.log @@ -0,0 +1,12 @@ +Cleaning output files: +out/production/classAsArgument/A.class +End of files +Compiling files: +src/A.java +End of files +Cleaning output files: +out/production/classAsArgument/Annotated.class +End of files +Compiling files: +src/Annotated.java +End of files diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/.name b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/.name new file mode 100644 index 000000000000..1ad8637be091 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/.name @@ -0,0 +1 @@ +classAsArgument \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/ant.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/ant.xml new file mode 100644 index 000000000000..2581ca3fe84c --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/ant.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/compiler.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/compiler.xml new file mode 100644 index 000000000000..a1b41c52c724 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/compiler.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/copyright/profiles_settings.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/copyright/profiles_settings.xml new file mode 100644 index 000000000000..3572571ad83c --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/copyright/profiles_settings.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/encodings.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/encodings.xml new file mode 100644 index 000000000000..e206d70d8595 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/misc.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/misc.xml new file mode 100644 index 000000000000..492d8ee45ce4 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/misc.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + IDEA jdk + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/modules.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/modules.xml new file mode 100644 index 000000000000..c4d3af7bae81 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/scopes/scope_settings.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/scopes/scope_settings.xml new file mode 100644 index 000000000000..922003b8433b --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/uiDesigner.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/uiDesigner.xml new file mode 100644 index 000000000000..3b0002030884 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/uiDesigner.xml @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/vcs.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/vcs.xml new file mode 100644 index 000000000000..def6a6a18457 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/workspace.xml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/workspace.xml new file mode 100644 index 000000000000..e3892d54faff --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/.idea/workspace.xml @@ -0,0 +1,431 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + 1336138927353 + 1336138927353 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/A.java.new b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/A.java.new new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/classAsArgument.iml b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/classAsArgument.iml new file mode 100644 index 000000000000..60a321a1ac4d --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/classAsArgument.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/A.java b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/A.java new file mode 100644 index 000000000000..655e62ac6607 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/A.java @@ -0,0 +1,9 @@ +/** + * Created with IntelliJ IDEA. + * User: db + * Date: 04.05.12 + * Time: 17:42 + * To change this template use File | Settings | File Templates. + */ +public class A { +} diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Ann.java b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Ann.java new file mode 100644 index 000000000000..bec2f9e97ecd --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Ann.java @@ -0,0 +1,13 @@ +/** + * Created with IntelliJ IDEA. + * User: db + * Date: 04.05.12 + * Time: 17:42 + * To change this template use File | Settings | File Templates. + */ +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.CLASS) public @interface Ann { + Class[] value(); +} \ No newline at end of file diff --git a/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Annotated.java b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Annotated.java new file mode 100644 index 000000000000..5c49f5d0ba47 --- /dev/null +++ b/java/java-tests/testData/compileServer/incremental/annotations/classAsArgument/src/Annotated.java @@ -0,0 +1,10 @@ +/** + * Created with IntelliJ IDEA. + * User: db + * Date: 04.05.12 + * Time: 17:43 + * To change this template use File | Settings | File Templates. + */ +@Ann({A.class}) +public class Annotated { +} diff --git a/jps/jps-builders/testSrc/org/jetbrains/ether/AnnotationTest.java b/jps/jps-builders/testSrc/org/jetbrains/ether/AnnotationTest.java index 638c570e7b5a..42815470cae9 100644 --- a/jps/jps-builders/testSrc/org/jetbrains/ether/AnnotationTest.java +++ b/jps/jps-builders/testSrc/org/jetbrains/ether/AnnotationTest.java @@ -56,6 +56,10 @@ public class AnnotationTest extends IncrementalTestCase { doTest(); } + public void testClassAsArgument() throws Exception { + doTest(); + } + /* Discussion is needed --- unnecessarily conservative public void testMetaAnnotationChanged() throws Exception { doTest(); diff --git a/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java b/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java index fb1a9ee7eb5c..f45e8fa2e304 100644 --- a/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java +++ b/jps/model/src/org/jetbrains/ether/dependencyView/ClassfileAnalyzer.java @@ -154,6 +154,14 @@ class ClassfileAnalyzer { final String methodDescr = getMethodDescr(value); final int methodName = context.get(name); + if (value instanceof Type) { + final String className = ((Type)value).getClassName(); + + if (className != null) { + usages.addUsage(residence, UsageRepr.createClassUsage(context, context.get(className))); + } + } + usages.addUsage(residence, UsageRepr.createMethodUsage(context, methodName, type.className, methodDescr)); usages.addUsage(residence, UsageRepr.createMetaMethodUsage(context, methodName, type.className, methodDescr)); From 880714d8e8a354a23b85618170d0592bbffe0692 Mon Sep 17 00:00:00 2001 From: Denis Dereka Date: Fri, 4 May 2012 20:20:42 +0400 Subject: [PATCH 5/8] IDEA-78472 Add mnemonics to the Revert button, rename cancel button. https://github.com/JetBrains/intellij-community/pull/5 Change _ to & in resource files. --- .../intellij/openapi/vcs/changes/ui/RollbackChangesDialog.java | 2 ++ plugins/git4idea/src/git4idea/i18n/GitBundle.properties | 2 +- .../hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/RollbackChangesDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/RollbackChangesDialog.java index eafe8d1bd3ff..ec5c93c44271 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/RollbackChangesDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/RollbackChangesDialog.java @@ -15,6 +15,7 @@ */ package com.intellij.openapi.vcs.changes.ui; +import com.intellij.CommonBundle; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; @@ -117,6 +118,7 @@ public class RollbackChangesDialog extends DialogWrapper { setTitle(VcsBundle.message("changes.action.rollback.custom.title", operationName).replace("_", "")); setOKButtonText(operationName); + setCancelButtonText(CommonBundle.getCloseButtonText()); myBrowser.setToggleActionTitle("Include in " + operationName.toLowerCase()); for (Change c : changes) { diff --git a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties index d97f309ca2a3..1935443d9ea0 100644 --- a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties +++ b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties @@ -358,7 +358,7 @@ reset.type=Reset &Type: reset.validate.tooltip=Validate the commit pointer and check the content of referenced commit. reset.validate=&Validate resetting.title=Resetting HEAD... -revert.action.name=Revert +revert.action.name=&Revert revert.reverting.mulitple=Reverting {0} files revert.reverting=Reverting files... revision.graph=RevisionGraph diff --git a/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties b/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties index 37d0dcccdd99..56c8038239b6 100644 --- a/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties +++ b/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties @@ -17,7 +17,7 @@ action.hg4idea.mq.rebase.description=Update and rebase patches hg4idea.mercurial=Mercurial hg4idea.error=Error -hg4idea.revert=Revert +hg4idea.revert=&Revert hg4idea.commit=Commit hg4idea.add.title=Add files to Mercurial From 5fb349cd8379231195adc6152b11cc3e539b4e0c Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Fri, 4 May 2012 18:13:27 +0200 Subject: [PATCH 6/8] clean dirs only --- .../plugins/groovy/compiler/GroovyCompilerTest.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy index 9dfb4d16ec60..d2ee4fc4125e 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTest.groovy @@ -646,7 +646,9 @@ public class Main { File[] files = systemRoot.listFiles() if (files != null) { for (File file : files) { - FileUtil.delete(file); + if (file.isDirectory()) { + FileUtil.delete(file); + } } } } From 26933cb1c83a419bd345da08f29f06374cd87fe0 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Fri, 4 May 2012 18:45:47 +0200 Subject: [PATCH 7/8] correctly clean source-to-outputs storage --- .../jps/incremental/CompileContext.java | 63 ++++++++++--------- .../jps/incremental/IncProjectBuilder.java | 20 ++++-- .../jetbrains/jps/incremental/fs/FSState.java | 8 +++ .../jps/incremental/fs/FilesDelta.java | 12 ++++ 4 files changed, 69 insertions(+), 34 deletions(-) diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/CompileContext.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/CompileContext.java index 0aab018bb789..dc71440c418e 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/CompileContext.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/CompileContext.java @@ -234,46 +234,51 @@ public class CompileContext extends UserDataHolderBase implements MessageHandler } void onChunkBuildComplete(@NotNull ModuleChunk chunk) throws IOException { - getDataManager().closeSourceToOutputStorages(chunk, isCompilingTests()); - getDataManager().flush(true); + final boolean compilingTests = isCompilingTests(); myProjectDescriptor.fsState.clearContextRoundData(); myProjectDescriptor.fsState.clearContextChunk(); - if (!myErrorsFound && !myCancelStatus.isCanceled()) { - final boolean compilingTests = isCompilingTests(); - final DirtyMarkScope dirtyScope = compilingTests ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION; - boolean marked = false; - for (Module module : chunk.getModules()) { - if (isMake()) { - // ensure non-incremental flag cleared - myNonIncrementalModules.remove(new Pair(module, dirtyScope)); - } - if (isProjectRebuild()) { - myProjectDescriptor.fsState.markInitialScanPerformed(module.getName(), compilingTests); - } - final List roots = myProjectDescriptor.rootsIndex.getModuleRoots(module); - for (RootDescriptor descriptor : roots) { - if (compilingTests? descriptor.isTestRoot : !descriptor.isTestRoot) { - marked |= myProjectDescriptor.fsState.markAllUpToDate(getScope(), descriptor, myTimestamps, myCompilationStartStamp); + final BuildDataManager dataManager = getDataManager(); + try { + if (!myErrorsFound && !myCancelStatus.isCanceled()) { + final DirtyMarkScope dirtyScope = compilingTests ? DirtyMarkScope.TESTS : DirtyMarkScope.PRODUCTION; + boolean marked = false; + for (Module module : chunk.getModules()) { + if (isMake()) { + // ensure non-incremental flag cleared + myNonIncrementalModules.remove(new Pair(module, dirtyScope)); + } + if (isProjectRebuild()) { + myProjectDescriptor.fsState.markInitialScanPerformed(module.getName(), compilingTests); + } + final List roots = myProjectDescriptor.rootsIndex.getModuleRoots(module); + for (RootDescriptor descriptor : roots) { + if (compilingTests? descriptor.isTestRoot : !descriptor.isTestRoot) { + marked |= myProjectDescriptor.fsState.markAllUpToDate(getScope(), descriptor, myTimestamps, myCompilationStartStamp); + } } } - } - // clean mapping only after everything else is processed - final Map> map = Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.get(this); - if (map != null) { - for (Map.Entry> entry : map.entrySet()) { - final SourceToOutputMapping mapping = getDataManager().getSourceToOutputMap(entry.getKey(), isCompilingTests()); - for (String path : entry.getValue()) { - mapping.remove(path); + // clean mapping only after everything else is processed + final Map> map = Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.get(this); + if (map != null) { + for (Map.Entry> entry : map.entrySet()) { + final SourceToOutputMapping mapping = dataManager.getSourceToOutputMap(entry.getKey(), isCompilingTests()); + for (String path : entry.getValue()) { + mapping.remove(path); + } } } - } - if (marked) { - processMessage(UptoDateFilesSavedEvent.INSTANCE); + if (marked) { + processMessage(UptoDateFilesSavedEvent.INSTANCE); + } } } + finally { + dataManager.closeSourceToOutputStorages(chunk, compilingTests); + dataManager.flush(true); + } } public CompileScope getScope() { diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java index 0017e49625f2..c5db47f94d44 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java @@ -489,7 +489,8 @@ public class IncProjectBuilder { final Map> perModuleRemovedSources = new HashMap>(); for (Module module : chunk.getModules()) { - final Collection deletedPaths = myProjectDescriptor.fsState.getDeletedPaths(module.getName(), context.isCompilingTests()); + final Collection deletedPaths = myProjectDescriptor.fsState.getAndClearDeletedPaths(module.getName(), + context.isCompilingTests()); if (deletedPaths.isEmpty()) { continue; } @@ -525,7 +526,6 @@ public class IncProjectBuilder { new File(output).delete(); } } - //sourceToOutputStorage.remove(deletedSource); // check if deleted source was associated with a form final SourceToFormMapping sourceToFormMap = context.getDataManager().getSourceToFormMap(); @@ -545,10 +545,20 @@ public class IncProjectBuilder { allChunkRemovedSources.addAll(currentData); } Utils.CHUNK_REMOVED_SOURCES_KEY.set(context, allChunkRemovedSources); - Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.set(context, perModuleRemovedSources); - for (Module module : chunk.getModules()) { - myProjectDescriptor.fsState.clearDeletedPaths(module.getName(), context.isCompilingTests()); + + final Map> existing = Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.get(context); + if (existing != null) { + for (Map.Entry> entry : existing.entrySet()) { + final Collection paths = perModuleRemovedSources.get(entry.getKey()); + if (paths != null) { + paths.addAll(entry.getValue()); + } + else { + perModuleRemovedSources.put(entry.getKey(), entry.getValue()); + } + } } + Utils.CHUNK_PER_MODULE_REMOVED_SOURCES_KEY.set(context, perModuleRemovedSources); } } catch (IOException e) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FSState.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FSState.java index e5fb5aefa815..24fb0f2a61ec 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FSState.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FSState.java @@ -113,6 +113,14 @@ public class FSState { } } + public Collection getAndClearDeletedPaths(final String moduleName, final boolean forTests) { + final FilesDelta delta = myDeltas.get(moduleName); + if (delta != null) { + return delta.getAndClearDeletedPaths(forTests); + } + return Collections.emptyList(); + } + @NotNull protected final FilesDelta getDelta(final String moduleName) { synchronized (myDeltas) { diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FilesDelta.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FilesDelta.java index 883272e104b3..b3079ec10f65 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FilesDelta.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/fs/FilesDelta.java @@ -127,6 +127,18 @@ final class FilesDelta { deleted.clear(); } + public Set getAndClearDeletedPaths(boolean isTest) { + final Set deleted = isTest? myDeletedTests : myDeletedProduction; + synchronized (deleted) { + try { + return new HashSet(deleted); + } + finally { + deleted.clear(); + } + } + } + public Map> getSourcesToRecompile(boolean forTests) { return forTests? myTestsToRecompile : mySourcesToRecompile; } From d720ec825f9d2048b31587c454028016e29ab52e Mon Sep 17 00:00:00 2001 From: "andrey.zaytsev" Date: Fri, 4 May 2012 19:51:33 +0400 Subject: [PATCH 8/8] Edit Breakpoint: NPE from bookmarks view on editing breakpoint --- .../debugger/actions/JavaEditBreakpointActionHandler.java | 3 +++ .../intellij/xdebugger/impl/actions/ViewBreakpointsAction.java | 2 +- .../impl/actions/XDebuggerEditBreakpointActionHandler.java | 1 + .../intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java index 0013d27ed2d7..1278f72e8c35 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/JavaEditBreakpointActionHandler.java @@ -120,6 +120,9 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler public boolean isEnabled(@NotNull Project project, AnActionEvent event) { DataContext dataContext = event.getDataContext(); Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); + if (editor == null) { + return false; + } final Pair pair = XBreakpointUtil.findSelectedBreakpoint(project, editor); return pair.first != null && pair.second instanceof BreakpointWithHighlighter; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java index 07db6f0cbda3..a8d205efd602 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/ViewBreakpointsAction.java @@ -46,7 +46,7 @@ public class ViewBreakpointsAction extends AnAction implements AnAction.Transpar if (project == null) return; if (myInitialBreakpoint == null) { - Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); + Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); if (editor != null) { myInitialBreakpoint = XBreakpointUtil.findSelectedBreakpoint(project, editor).second; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerEditBreakpointActionHandler.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerEditBreakpointActionHandler.java index 8c59870b0164..593a37cca0dc 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerEditBreakpointActionHandler.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/actions/XDebuggerEditBreakpointActionHandler.java @@ -48,6 +48,7 @@ public class XDebuggerEditBreakpointActionHandler extends EditBreakpointActionHa public boolean isEnabled(@NotNull Project project, AnActionEvent event) { DataContext dataContext = event.getDataContext(); Editor editor = PlatformDataKeys.EDITOR.getData(dataContext); + if (editor == null) return false; final Pair pair = XBreakpointUtil.findSelectedBreakpoint(project, editor); return pair.first != null && pair.second instanceof XLineBreakpointImpl; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java index 20969fdb69a8..262ed8a6d942 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointUtil.java @@ -61,7 +61,7 @@ public class XBreakpointUtil { } @NotNull - public static Pair findSelectedBreakpoint(final Project project, final Editor editor) { + public static Pair findSelectedBreakpoint(@NotNull final Project project, @NotNull final Editor editor) { int offset = editor.getCaretModel().getOffset(); Document editorDocument = editor.getDocument();