mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
breakpoints ui. tree nodes grouping.
This commit is contained in:
@@ -214,8 +214,10 @@ public class JavaDebuggerSupport extends DebuggerSupport {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideBreakpointsGroupingRules(Collection<XBreakpointGroupingRule> rules) {
|
||||
public void createBreakpointsGroupingRules(Collection<XBreakpointGroupingRule> rules) {
|
||||
rules.add(new XBreakpointGroupingByCategoryRule());
|
||||
rules.add(new XBreakpointGroupingByPackageRule());
|
||||
rules.add(new XBreakpointGroupingByClassRule());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class XBreakpointClassGroup extends XBreakpointGroup {
|
||||
private static final String DEFAULT_PACKAGE_NAME = DebuggerBundle.message("default.package.name");
|
||||
|
||||
private String myPackageName;
|
||||
private String myClassName;
|
||||
|
||||
public XBreakpointClassGroup(@Nullable String packageName, String className) {
|
||||
myPackageName = packageName != null ? packageName : DEFAULT_PACKAGE_NAME;
|
||||
myClassName = className;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
return PlatformIcons.CLASS_ICON;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return getClassName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPackageName() {
|
||||
return myPackageName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getClassName() {
|
||||
return myClassName;
|
||||
}
|
||||
}
|
||||
+5
-7
@@ -22,18 +22,16 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 23.05.12
|
||||
* Time: 16:24
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
class XBreakpointGroupingByCategoryRule<B> extends XBreakpointGroupingRule<B, XBreakpointCategoryGroup> {
|
||||
XBreakpointGroupingByCategoryRule() {
|
||||
super("XBreakpointGroupingByCategoryRule", "Type");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlwaysEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XBreakpointCategoryGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointCategoryGroup> groups) {
|
||||
if (b instanceof Breakpoint) {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointFactory;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
class XBreakpointGroupingByClassRule<B> extends XBreakpointGroupingRule<B, XBreakpointClassGroup> {
|
||||
XBreakpointGroupingByClassRule() {
|
||||
super("XBreakpointGroupingByClassRule", "Group by Class");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlwaysEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XBreakpointClassGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointClassGroup> groups) {
|
||||
if (b instanceof Breakpoint) {
|
||||
final Breakpoint breakpoint = (Breakpoint)b;
|
||||
String className = breakpoint.getShortClassName();
|
||||
String packageName = breakpoint.getPackageName();
|
||||
if (className == null) {
|
||||
return null;
|
||||
}
|
||||
for (XBreakpointClassGroup group : groups) {
|
||||
if (group.getClassName().equals(className) && group.getPackageName().equals(packageName)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return new XBreakpointClassGroup(packageName, className);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.ui.breakpoints.BreakpointWithHighlighter;
|
||||
import com.intellij.debugger.ui.breakpoints.ExceptionBreakpoint;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public class XBreakpointGroupingByPackageRule<B> extends XBreakpointGroupingRule<B, XBreakpointPackageGroup> {
|
||||
|
||||
protected XBreakpointGroupingByPackageRule() {
|
||||
super("XBreakpointGroupingByPackageRule", "Group by package");
|
||||
}
|
||||
|
||||
@Override
|
||||
public XBreakpointPackageGroup getGroup(@NotNull B breakpoint, @NotNull Collection<XBreakpointPackageGroup> groups) {
|
||||
String packageName = null;
|
||||
if (breakpoint instanceof BreakpointWithHighlighter) {
|
||||
packageName = ((BreakpointWithHighlighter)breakpoint).getPackageName();
|
||||
}
|
||||
else if (breakpoint instanceof ExceptionBreakpoint) {
|
||||
packageName = ((ExceptionBreakpoint)breakpoint).getPackageName();
|
||||
}
|
||||
if (packageName == null) {
|
||||
return null;
|
||||
}
|
||||
for (XBreakpointPackageGroup group : groups) {
|
||||
if (StringUtil.equals(group.getPackageName(), packageName)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return new XBreakpointPackageGroup(packageName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class XBreakpointPackageGroup extends XBreakpointGroup {
|
||||
private static final String DEFAULT_PACKAGE_NAME = DebuggerBundle.message("default.package.name");
|
||||
|
||||
private String myPackageName;
|
||||
|
||||
public XBreakpointPackageGroup(String packageName) {
|
||||
myPackageName = packageName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
return PlatformIcons.PACKAGE_ICON;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
String packageName = getPackageName();
|
||||
return StringUtil.isEmpty(packageName) ? DEFAULT_PACKAGE_NAME : packageName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPackageName() {
|
||||
return myPackageName;
|
||||
}
|
||||
}
|
||||
@@ -679,7 +679,7 @@ public class BreakpointTree extends CheckboxTree {
|
||||
if (!(descriptor instanceof BreakpointDescriptor)) {
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
final Breakpoint breakpoint = ((BreakpointDescriptor)descriptor).getBreakpoint();
|
||||
final String packageName;
|
||||
if (breakpoint instanceof ExceptionBreakpoint) {
|
||||
|
||||
Reference in New Issue
Block a user