mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
breakpoints ui: list replaced with tree.
This commit is contained in:
@@ -33,9 +33,9 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.ui.popup.util.ItemWrapper;
|
||||
import com.intellij.ui.popup.util.SplitterItem;
|
||||
import com.intellij.xdebugger.AbstractDebuggerSession;
|
||||
import com.intellij.xdebugger.breakpoints.ui.BreakpointItem;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
|
||||
import com.intellij.xdebugger.impl.DebuggerSupport;
|
||||
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
|
||||
import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler;
|
||||
@@ -213,6 +213,11 @@ public class JavaDebuggerSupport extends DebuggerSupport {
|
||||
return result.toArray(new AnAction[result.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideBreakpointsGroupingRules(Collection<XBreakpointGroupingRule> rules) {
|
||||
rules.add(new XBreakpointGroupingByCategoryRule());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(final BreakpointsListener listener, Project project) {
|
||||
final MyBreakpointManagerListener listener1 = new MyBreakpointManagerListener(listener);
|
||||
@@ -254,13 +259,10 @@ public class JavaDebuggerSupport extends DebuggerSupport {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideBreakpointItems(Project project, Collection<ItemWrapper> items) {
|
||||
public void provideBreakpointItems(Project project, Collection<BreakpointItem> items) {
|
||||
for (BreakpointFactory breakpointFactory : BreakpointFactory.getBreakpointFactories()) {
|
||||
Key<? extends Breakpoint> category = breakpointFactory.getBreakpointCategory();
|
||||
Breakpoint[] breakpoints = DebuggerManagerEx.getInstanceEx(project).getBreakpointManager().getBreakpoints(category);
|
||||
if (breakpoints.length > 0) {
|
||||
items.add(new SplitterItem(breakpointFactory.getDisplayName()));
|
||||
}
|
||||
for (Breakpoint breakpoint : breakpoints) {
|
||||
items.add(breakpointFactory.createBreakpointItem(breakpoint));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.openapi.util.Key;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created with IntelliJ IDEA.
|
||||
* User: zajac
|
||||
* Date: 23.05.12
|
||||
* Time: 16:22
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class XBreakpointCategoryGroup extends XBreakpointGroup {
|
||||
private Key<? extends Breakpoint> myCategory;
|
||||
private Icon myIcon;
|
||||
private final String myName;
|
||||
|
||||
public XBreakpointCategoryGroup(BreakpointFactory factory) {
|
||||
myCategory = factory.getBreakpointCategory();
|
||||
myIcon = factory.getIcon();
|
||||
final String name = factory.getDisplayName();
|
||||
myName = name != null ? name : "UNKNOWN";
|
||||
}
|
||||
|
||||
public Key<? extends Breakpoint> getCategory() {
|
||||
return myCategory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
return myIcon;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
}
|
||||
+53
@@ -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;
|
||||
|
||||
/**
|
||||
* 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 XBreakpointCategoryGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointCategoryGroup> groups) {
|
||||
if (b instanceof Breakpoint) {
|
||||
final Breakpoint breakpoint = (Breakpoint)b;
|
||||
for (XBreakpointCategoryGroup group : groups) {
|
||||
if (group.getCategory().equals(breakpoint.getCategory())) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
final BreakpointFactory factory = BreakpointFactory.getInstance(breakpoint.getCategory());
|
||||
if (factory != null) {
|
||||
return new XBreakpointCategoryGroup(factory);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,9 @@ package com.intellij.debugger.ui.breakpoints;
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.popup.util.DetailView;
|
||||
import com.intellij.xdebugger.breakpoints.ui.BreakpointItem;
|
||||
|
||||
@@ -43,12 +43,11 @@ class JavaBreakpointItem extends BreakpointItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupRenderer(ColoredListCellRenderer renderer, Project project, boolean selected) {
|
||||
renderer.setIcon(myBreakpoint.getIcon());
|
||||
renderer.append(myBreakpoint.getShortName());
|
||||
protected void setupGenericRenderer(SimpleColoredComponent renderer) {
|
||||
//renderer.setIcon(myBreakpoint.getIcon());
|
||||
renderer.append(myBreakpoint.getShortName(), isEnabled() ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.GRAY_ATTRIBUTES);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String speedSearchText() {
|
||||
return myBreakpoint.getDisplayName();
|
||||
|
||||
Reference in New Issue
Block a user