diff --git a/platform/platform-resources/src/META-INF/xdebugger.xml b/platform/platform-resources/src/META-INF/xdebugger.xml index b064ac47ef72..20c6ab0eac74 100644 --- a/platform/platform-resources/src/META-INF/xdebugger.xml +++ b/platform/platform-resources/src/META-INF/xdebugger.xml @@ -50,6 +50,7 @@ + diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index c6b893b50ef6..b7cbde007467 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -660,6 +660,13 @@ public class XDebugSessionImpl implements XDebugSession { presentation.setErrorMessage(errorMessage); presentation.setIcon(icon); + + long timestamp = presentation.getTimestamp(); + if (timestamp != 0 && XDebuggerUtilImpl.getVerifiedIcon(breakpoint).equals(icon)) { + long delay = System.currentTimeMillis() - timestamp; + presentation.setTimestamp(0); + BreakpointsUsageCollector.reportUsage(myProject, "verified." + (int)Math.pow(10,(int)Math.log10(delay)) + "+"); + } } myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueBreakpointUpdate((XLineBreakpointImpl)breakpoint); } @@ -955,8 +962,16 @@ public class XDebugSessionImpl implements XDebugSession { private final class MyBreakpointListener implements XBreakpointListener> { @Override public void breakpointAdded(@NotNull final XBreakpoint breakpoint) { - if (!myBreakpointsDisabled) { - processAllHandlers(breakpoint, true); + if (processAdd(breakpoint)) { + CustomizedBreakpointPresentation presentation = getBreakpointPresentation(breakpoint); + if (presentation != null) { + if (XDebuggerUtilImpl.getVerifiedIcon(breakpoint).equals(presentation.getIcon())) { + BreakpointsUsageCollector.reportUsage(myProject, "verified.0"); + } + else { + presentation.setTimestamp(System.currentTimeMillis()); + } + } } } @@ -972,10 +987,18 @@ public class XDebugSessionImpl implements XDebugSession { processAllHandlers(breakpoint, false); } + boolean processAdd(@NotNull final XBreakpoint breakpoint) { + if (!myBreakpointsDisabled) { + processAllHandlers(breakpoint, true); + return true; + } + return false; + } + @Override public void breakpointChanged(@NotNull final XBreakpoint breakpoint) { processRemove(breakpoint); - breakpointAdded(breakpoint); + processAdd(breakpoint); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsUsageCollector.kt b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsUsageCollector.kt new file mode 100644 index 000000000000..a210474e348a --- /dev/null +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/BreakpointsUsageCollector.kt @@ -0,0 +1,22 @@ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.xdebugger.impl.breakpoints + +import com.intellij.internal.statistic.service.fus.collectors.FUSProjectUsageTrigger +import com.intellij.internal.statistic.service.fus.collectors.ProjectUsageTriggerCollector +import com.intellij.internal.statistic.service.fus.collectors.UsageDescriptorKeyValidator +import com.intellij.openapi.project.Project + +/** + * @author egor + */ +class BreakpointsUsageCollector : ProjectUsageTriggerCollector() { + override fun getGroupId(): String = "statistics.debugger.breakpoints.usage" + + companion object { + @JvmStatic + fun reportUsage(project: Project, featureId: String) { + FUSProjectUsageTrigger.getInstance(project).trigger(BreakpointsUsageCollector::class.java, + UsageDescriptorKeyValidator.ensureProperKey(featureId)) + } + } +} \ No newline at end of file diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java index 6f334a7fab8b..1ba611065c29 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 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. - */ +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.xdebugger.impl.breakpoints; import org.jetbrains.annotations.Nullable; @@ -25,6 +11,7 @@ import javax.swing.*; public class CustomizedBreakpointPresentation { private Icon myIcon; private String myErrorMessage; + private volatile long myTimestamp; // for statistics public void setIcon(@Nullable Icon icon) { myIcon = icon; @@ -43,4 +30,12 @@ public class CustomizedBreakpointPresentation { public String getErrorMessage() { return myErrorMessage; } + + public long getTimestamp() { + return myTimestamp; + } + + public void setTimestamp(long timestamp) { + myTimestamp = timestamp; + } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java index e77a5d745a58..a3a89ad317e0 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointManagerImpl.java @@ -119,6 +119,13 @@ public class XBreakpointManagerImpl implements XBreakpointManager { } else { myBreakpoints.put(type, breakpoint); + if (initUI) { + BreakpointsUsageCollector.reportUsage(myProject, "new.breakpoint"); + BreakpointsUsageCollector.reportUsage(myProject, "new." + type.getId()); + if (myDebuggerManager.getCurrentSession() != null) { + BreakpointsUsageCollector.reportUsage(myProject, "new.within.session"); + } + } } myAllBreakpoints.add(breakpoint); if (breakpoint instanceof XLineBreakpointImpl) {