mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+12
-7
@@ -32,8 +32,10 @@ import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.impl.actions.EditBreakpointActionHandler;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsMasterDetailPopupFactory;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -49,7 +51,7 @@ import java.awt.*;
|
||||
*/
|
||||
public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler {
|
||||
@Override
|
||||
protected void doShowPopup(Project project, final EditorGutterComponentEx gutterComponent, final Point whereToShow, Object breakpoint) {
|
||||
protected void doShowPopup(final Project project, final EditorGutterComponentEx gutterComponent, final Point whereToShow, Object breakpoint) {
|
||||
if (!(breakpoint instanceof BreakpointWithHighlighter)) return;
|
||||
|
||||
final BreakpointWithHighlighter javaBreakpoint = (BreakpointWithHighlighter)breakpoint;
|
||||
@@ -88,13 +90,16 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
|
||||
final Runnable showMoreOptions = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
propertiesPanel.setMoreOptionsVisible(true);
|
||||
final Balloon newBalloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, null);
|
||||
newBalloon.addListener(saveOnClose);
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BreakpointsMasterDetailPopupFactory.
|
||||
getInstance(project).createPopup(javaBreakpoint).showCenteredInCurrentWindow(project);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent,
|
||||
propertiesPanel.isMoreOptionsVisible() ? null : showMoreOptions);
|
||||
final Balloon balloon = DebuggerUIUtil.showBreakpointEditor(project, mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
|
||||
balloon.addListener(saveOnClose);
|
||||
|
||||
propertiesPanel.setDelegate(new BreakpointPropertiesPanel.Delegate() {
|
||||
@@ -103,7 +108,7 @@ public class JavaEditBreakpointActionHandler extends EditBreakpointActionHandler
|
||||
propertiesPanel.setActionsPanelVisible(true);
|
||||
balloon.hide();
|
||||
final Balloon newBalloon =
|
||||
DebuggerUIUtil.showBreakpointEditor(mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
|
||||
DebuggerUIUtil.showBreakpointEditor(project, mainPanel, displayName, whereToShow, gutterComponent, showMoreOptions);
|
||||
newBalloon.addListener(saveOnClose);
|
||||
}
|
||||
});
|
||||
|
||||
+1
@@ -522,6 +522,7 @@ public abstract class BreakpointWithHighlighter extends Breakpoint {
|
||||
if (!highlighter.isValid()) {
|
||||
return null;
|
||||
}
|
||||
highlighter.putUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY, Boolean.TRUE);
|
||||
highlighter.setErrorStripeTooltip(DebuggerBundle.message("breakpoint.tooltip.text", lineIndex + 1));
|
||||
return highlighter;
|
||||
}
|
||||
|
||||
@@ -52,12 +52,6 @@ public class DetailViewImpl extends JPanel implements DetailView {
|
||||
private JLabel myNothingToShowInEditor = new JLabel("Nothing to show");
|
||||
private RangeHighlighter myHighlighter;
|
||||
|
||||
public void setScheme(EditorColorsScheme scheme) {
|
||||
myScheme = scheme;
|
||||
}
|
||||
|
||||
private EditorColorsScheme myScheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
|
||||
public DetailViewImpl(Project project) {
|
||||
super(new BorderLayout());
|
||||
myProject = project;
|
||||
@@ -120,7 +114,7 @@ public class DetailViewImpl extends JPanel implements DetailView {
|
||||
remove(myNothingToShowInEditor);
|
||||
setEditor(EditorFactory.getInstance().createViewer(document, project));
|
||||
|
||||
final EditorColorsScheme scheme = getScheme();
|
||||
final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
|
||||
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
|
||||
|
||||
@@ -155,11 +149,6 @@ public class DetailViewImpl extends JPanel implements DetailView {
|
||||
}
|
||||
}
|
||||
|
||||
public EditorColorsScheme getScheme() {
|
||||
return myScheme;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void clearHightlighting() {
|
||||
if (myHighlighter != null) {
|
||||
|
||||
@@ -43,7 +43,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileFilter;
|
||||
import com.intellij.util.*;
|
||||
@@ -72,10 +72,12 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
@SuppressWarnings("UseOfSystemOutOrSystemErr")
|
||||
public class PlatformTestUtil {
|
||||
public static final boolean COVERAGE_ENABLED_BUILD = "true".equals(System.getProperty("idea.coverage.enabled.build"));
|
||||
public static final CvsVirtualFileFilter CVS_FILE_FILTER = new CvsVirtualFileFilter();
|
||||
@@ -616,11 +618,15 @@ public class PlatformTestUtil {
|
||||
|
||||
public static void assertDirectoriesEqual(VirtualFile dirAfter, VirtualFile dirBefore, @Nullable VirtualFileFilter fileFilter) throws IOException {
|
||||
FileDocumentManager.getInstance().saveAllDocuments();
|
||||
|
||||
dirAfter.getChildren();
|
||||
dirAfter.refresh(false, false);
|
||||
VirtualFile[] childrenAfter = dirAfter.getChildren();
|
||||
if (dirAfter.isInLocalFileSystem()) {
|
||||
File[] ioAfter = new File(dirAfter.getPath()).listFiles();
|
||||
shallowCompare(childrenAfter, ioAfter);
|
||||
}
|
||||
|
||||
VirtualFile[] childrenBefore = dirBefore.getChildren();
|
||||
if (dirBefore.isInLocalFileSystem()) {
|
||||
File[] ioBefore = new File(dirBefore.getPath()).listFiles();
|
||||
@@ -672,16 +678,27 @@ public class PlatformTestUtil {
|
||||
|
||||
public static void assertFilesEqual(VirtualFile fileAfter, VirtualFile fileBefore) throws IOException {
|
||||
try {
|
||||
assertJarFilesEqual(VfsUtil.virtualToIoFile(fileAfter), VfsUtil.virtualToIoFile(fileBefore));
|
||||
assertJarFilesEqual(VfsUtilCore.virtualToIoFile(fileAfter), VfsUtilCore.virtualToIoFile(fileBefore));
|
||||
}
|
||||
catch (IOException e) {
|
||||
FileDocumentManager manager = FileDocumentManager.getInstance();
|
||||
|
||||
Document docBefore = manager.getDocument(fileBefore);
|
||||
boolean canLoadBeforeText = !fileBefore.getFileType().isBinary() || fileBefore.getFileType() == FileTypes.UNKNOWN;
|
||||
String textB = docBefore == null ? !canLoadBeforeText ? null : LoadTextUtil.getTextByBinaryPresentation(fileBefore.contentsToByteArray(false), fileBefore).toString() : docBefore.getText();
|
||||
String textB = docBefore != null
|
||||
? docBefore.getText()
|
||||
: !canLoadBeforeText
|
||||
? null
|
||||
: LoadTextUtil.getTextByBinaryPresentation(fileBefore.contentsToByteArray(false), fileBefore).toString();
|
||||
|
||||
Document docAfter = manager.getDocument(fileAfter);
|
||||
boolean canLoadAfterText = !fileBefore.getFileType().isBinary() || fileBefore.getFileType() == FileTypes.UNKNOWN;
|
||||
String textA = docAfter == null ? !canLoadAfterText ? null : LoadTextUtil.getTextByBinaryPresentation(fileAfter.contentsToByteArray(false), fileAfter).toString() : docAfter.getText();
|
||||
String textA = docAfter != null
|
||||
? docAfter.getText()
|
||||
: !canLoadAfterText
|
||||
? null
|
||||
: LoadTextUtil.getTextByBinaryPresentation(fileAfter.contentsToByteArray(false), fileAfter).toString();
|
||||
|
||||
if (textA != null && textB != null) {
|
||||
Assert.assertEquals(fileAfter.getPath(), textA, textB);
|
||||
}
|
||||
@@ -692,28 +709,30 @@ public class PlatformTestUtil {
|
||||
}
|
||||
|
||||
public static void assertJarFilesEqual(File file1, File file2) throws IOException {
|
||||
JarFile jarFile1 = null;
|
||||
JarFile jarFile2 = null;
|
||||
final File tempDirectory1;
|
||||
final File tempDirectory2;
|
||||
|
||||
final JarFile jarFile1 = new JarFile(file1);
|
||||
try {
|
||||
jarFile2 = new JarFile(file2);
|
||||
jarFile1 = new JarFile(file1);
|
||||
tempDirectory1 = PlatformTestCase.createTempDir("tmp1");
|
||||
tempDirectory2 = PlatformTestCase.createTempDir("tmp2");
|
||||
ZipUtil.extract(jarFile1, tempDirectory1, CVS_FILE_FILTER);
|
||||
ZipUtil.extract(jarFile2, tempDirectory2, CVS_FILE_FILTER);
|
||||
}
|
||||
finally {
|
||||
if (jarFile1 != null) {
|
||||
jarFile1.close();
|
||||
final JarFile jarFile2 = new JarFile(file2);
|
||||
try {
|
||||
tempDirectory1 = PlatformTestCase.createTempDir("tmp1");
|
||||
tempDirectory2 = PlatformTestCase.createTempDir("tmp2");
|
||||
ZipUtil.extract(jarFile1, tempDirectory1, CVS_FILE_FILTER);
|
||||
ZipUtil.extract(jarFile2, tempDirectory2, CVS_FILE_FILTER);
|
||||
}
|
||||
if (jarFile2 != null) {
|
||||
finally {
|
||||
jarFile2.close();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
jarFile1.close();
|
||||
}
|
||||
|
||||
final VirtualFile dirAfter = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory1);
|
||||
assertNotNull(tempDirectory1.toString(), dirAfter);
|
||||
final VirtualFile dirBefore = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory2);
|
||||
assertNotNull(tempDirectory2.toString(), dirBefore);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
+26
-1
@@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.LogicalPosition;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.impl.DocumentMarkupModel;
|
||||
import com.intellij.openapi.editor.markup.MarkupModel;
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
@@ -46,7 +50,28 @@ public abstract class BreakpointItem implements ItemWrapper {
|
||||
public abstract void setEnabled(boolean state);
|
||||
|
||||
protected void showInEditor(DetailView panel, VirtualFile virtualFile, int line) {
|
||||
panel.navigateInPreviewEditor(virtualFile, new LogicalPosition(line, 0), null);
|
||||
TextAttributes attributes =
|
||||
EditorColorsManager.getInstance().getGlobalScheme().getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES);
|
||||
|
||||
panel.navigateInPreviewEditor(virtualFile, new LogicalPosition(line, 0), attributes);
|
||||
|
||||
TextAttributes softerAttributes = attributes.clone();
|
||||
softerAttributes.setBackgroundColor(ColorUtil.softer(softerAttributes.getBackgroundColor()));
|
||||
|
||||
final Editor editor = panel.getEditor();
|
||||
final MarkupModel editorModel = editor.getMarkupModel();
|
||||
final MarkupModel documentModel =
|
||||
DocumentMarkupModel.forDocument(editor.getDocument(), editor.getProject(), false);
|
||||
|
||||
for (RangeHighlighter highlighter : documentModel.getAllHighlighters()) {
|
||||
if (highlighter.getUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY) == Boolean.TRUE) {
|
||||
final int line1 = editor.offsetToLogicalPosition(highlighter.getStartOffset()).line;
|
||||
if (line1 != line) {
|
||||
editorModel.addLineHighlighter(line1,
|
||||
DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER + 1, softerAttributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.intellij.xdebugger.ui;
|
||||
import com.intellij.openapi.editor.colors.ColorKey;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.markup.HighlighterLayer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -31,5 +32,7 @@ public interface DebuggerColors {
|
||||
ColorKey RECURSIVE_CALL_ATTRIBUTES = ColorKey.createColorKey("RECURSIVE_CALL_ATTRIBUTES", new Color(255, 255, 215));
|
||||
|
||||
int BREAKPOINT_HIGHLIGHTER_LAYER = HighlighterLayer.SYNTAX + 1;
|
||||
|
||||
Key<Boolean> BREAKPOINT_HIGHLIGHTER_KEY = Key.create("BREAKPOINT_HIGHLIGHTER_KEY");
|
||||
int EXECUTION_LINE_HIGHLIGHTERLAYER = HighlighterLayer.SELECTION - 1;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="lang-api" exported="" />
|
||||
<orderEntry type="module" module-name="platform-impl" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
+1
@@ -87,6 +87,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak
|
||||
if (highlighter != null) {
|
||||
updateIcon();
|
||||
highlighter.setGutterIconRenderer(createGutterIconRenderer());
|
||||
highlighter.putUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY, Boolean.TRUE);
|
||||
}
|
||||
myHighlighter = highlighter;
|
||||
}
|
||||
|
||||
+14
-12
@@ -87,8 +87,8 @@ public class BreakpointItemsTree extends CheckboxTree {
|
||||
}
|
||||
//TreeUtil.sort(myRoot, myComparator);
|
||||
((DefaultTreeModel)getModel()).nodeStructureChanged(myRoot);
|
||||
expandPath(new TreePath(myRoot));
|
||||
state.applyTo(this, myRoot);
|
||||
TreeUtil.expandAll(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,23 +114,25 @@ public class BreakpointItemsTree extends CheckboxTree {
|
||||
groups = Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
Collection<XBreakpointGroup> filtered = new ArrayList<XBreakpointGroup>();
|
||||
for (XBreakpointGroup group : groups) {
|
||||
TreeNode parent = myGroupNodes.get(group).getParent();
|
||||
if ((parentGroup == null && parent == myRoot) || ((BreakpointsGroupNode)parent).getGroup() == parentGroup) {
|
||||
filtered.add(group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XBreakpointGroup group = groupingRule.getGroup(breakpoint.getBreakpoint(), filtered);
|
||||
XBreakpointGroup group = groupingRule.getGroup(breakpoint.getBreakpoint(), filterByParent(parentGroup, groups));
|
||||
if (group != null) {
|
||||
myGroups.put(groupingRule, group);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
||||
private Collection<XBreakpointGroup> filterByParent(XBreakpointGroup parentGroup, Collection<XBreakpointGroup> groups) {
|
||||
Collection<XBreakpointGroup> filtered = new ArrayList<XBreakpointGroup>();
|
||||
for (XBreakpointGroup group : groups) {
|
||||
TreeNode parentNode = myGroupNodes.get(group).getParent();
|
||||
BreakpointsGroupNode parent = parentNode instanceof BreakpointsGroupNode ? (BreakpointsGroupNode)parentNode : null;
|
||||
if ((parentGroup == null && parentNode == myRoot) || (parent != null && parent.getGroup() == parentGroup)) {
|
||||
filtered.add(group);
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private <G extends XBreakpointGroup> BreakpointsGroupNode<G> getOrCreateGroupNode(CheckedTreeNode parent, final G group,
|
||||
final int level) {
|
||||
//noinspection unchecked
|
||||
|
||||
-4
@@ -18,7 +18,6 @@ package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.actionSystem.ex.CheckboxAction;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
@@ -32,7 +31,6 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.JBPopupListener;
|
||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.ListUtil;
|
||||
import com.intellij.ui.popup.util.MasterDetailPopupBuilder;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
@@ -131,8 +129,6 @@ public class BreakpointMasterDetailPopupBuilder {
|
||||
|
||||
myTree.setBorder(IdeBorderFactory.createBorder());
|
||||
|
||||
myPopupBuilder.getDetailView().setScheme(createScheme());
|
||||
|
||||
myTree.setDelegate(new BreakpointItemsTree.BreakpointItemsTreeDelegate() {
|
||||
@Override
|
||||
public void execute(BreakpointItem item) {
|
||||
|
||||
+24
-6
@@ -15,23 +15,25 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.Balloon;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
import com.intellij.ui.popup.util.MasterDetailPopupBuilder;
|
||||
import com.intellij.xdebugger.breakpoints.ui.BreakpointItem;
|
||||
import com.intellij.openapi.ui.popup.JBPopupListener;
|
||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.xdebugger.impl.DebuggerSupport;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class BreakpointsMasterDetailPopupFactory {
|
||||
|
||||
private final List<BreakpointPanelProvider> myBreakpointPanelProviders;
|
||||
private Project myProject;
|
||||
private Balloon myBalloonToHide;
|
||||
|
||||
public BreakpointsMasterDetailPopupFactory(Project project) {
|
||||
myProject = project;
|
||||
@@ -47,6 +49,10 @@ public class BreakpointsMasterDetailPopupFactory {
|
||||
});
|
||||
}
|
||||
|
||||
public void setBalloonToHide(Balloon balloonToHide) {
|
||||
myBalloonToHide = balloonToHide;
|
||||
}
|
||||
|
||||
public static BreakpointsMasterDetailPopupFactory getInstance(Project project) {
|
||||
return ServiceManager.getService(project, BreakpointsMasterDetailPopupFactory.class);
|
||||
}
|
||||
@@ -55,6 +61,18 @@ public class BreakpointsMasterDetailPopupFactory {
|
||||
BreakpointMasterDetailPopupBuilder builder = new BreakpointMasterDetailPopupBuilder(myProject);
|
||||
builder.setInitialBreakpoint(initialBreakpoint);
|
||||
builder.setBreakpointsPanelProviders(myBreakpointPanelProviders);
|
||||
return builder.createPopup();
|
||||
final JBPopup popup = builder.createPopup();
|
||||
popup.addListener(new JBPopupListener() {
|
||||
@Override
|
||||
public void beforeShown(LightweightWindowEvent event) {
|
||||
myBalloonToHide.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClosed(LightweightWindowEvent event) {
|
||||
//To change body of implemented methods use File | Settings | File Templates.
|
||||
}
|
||||
});
|
||||
return popup;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BreakpointEditor {
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myShowMoreOptionsLink = new LinkLabel("More Options", null, new LinkListener() {
|
||||
myShowMoreOptionsLink = new LinkLabel("View Breakpoints...", null, new LinkListener() {
|
||||
@Override
|
||||
public void linkSelected(LinkLabel aSource, Object aLinkData) {
|
||||
if (myDelegate != null) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.ui.popup.*;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.DimensionService;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
@@ -33,6 +34,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointListener;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointManager;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsMasterDetailPopupFactory;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -168,17 +170,44 @@ public class DebuggerUIUtil {
|
||||
final XLightBreakpointPropertiesPanel propertiesPanel =
|
||||
new XLightBreakpointPropertiesPanel(project, breakpointManager,
|
||||
breakpoint, showAllOptions);
|
||||
|
||||
final Ref<Balloon> balloonRef = Ref.create(null);
|
||||
final Ref<Boolean> isLoading = Ref.create(Boolean.FALSE);
|
||||
|
||||
propertiesPanel.setDelegate(new XLightBreakpointPropertiesPanel.Delegate() {
|
||||
@Override
|
||||
public void showMoreOptions() {
|
||||
if (!isLoading.get()) {
|
||||
propertiesPanel.saveProperties();
|
||||
}
|
||||
if (!balloonRef.isNull()) {
|
||||
balloonRef.get().hide();
|
||||
}
|
||||
showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
isLoading.set(Boolean.TRUE);
|
||||
propertiesPanel.loadProperties();
|
||||
isLoading.set(Boolean.FALSE);
|
||||
|
||||
final JComponent mainPanel = propertiesPanel.getMainPanel();
|
||||
|
||||
final Runnable showMoreOptions = new Runnable() {
|
||||
final Runnable viewBreakpoints = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
propertiesPanel.saveProperties();
|
||||
showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
//showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
BreakpointsMasterDetailPopupFactory.
|
||||
getInstance(project).createPopup(breakpoint).showCenteredInCurrentWindow(project);
|
||||
}
|
||||
};
|
||||
final Balloon balloon = showBreakpointEditor(mainPanel, breakpoint.getType().getDisplayText(breakpoint), point, component, propertiesPanel.showMoreOptions() ? showMoreOptions : null);
|
||||
|
||||
final Balloon balloon = showBreakpointEditor(project, mainPanel, breakpoint.getType().getDisplayText(breakpoint), point, component, viewBreakpoints);
|
||||
balloonRef.set(balloon);
|
||||
|
||||
|
||||
final XBreakpointListener<XBreakpoint<?>> breakpointListener = new XBreakpointListener<XBreakpoint<?>>() {
|
||||
@Override
|
||||
public void breakpointAdded(@NotNull XBreakpoint<?> breakpoint1) {
|
||||
@@ -208,14 +237,7 @@ public class DebuggerUIUtil {
|
||||
}
|
||||
});
|
||||
|
||||
propertiesPanel.setDelegate(new XLightBreakpointPropertiesPanel.Delegate() {
|
||||
@Override
|
||||
public void showMoreOptions() {
|
||||
propertiesPanel.saveProperties();
|
||||
balloon.hide();
|
||||
showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (point == null) {
|
||||
@@ -233,14 +255,14 @@ public class DebuggerUIUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static Balloon showBreakpointEditor(final JComponent mainPanel,
|
||||
public static Balloon showBreakpointEditor(Project project, final JComponent mainPanel,
|
||||
final String displayName,
|
||||
final Point whereToShow,
|
||||
final JComponent component,
|
||||
@Nullable final Runnable showMoreOptions) {
|
||||
final BreakpointEditor editor = new BreakpointEditor();
|
||||
editor.setPropertiesPanel(mainPanel);
|
||||
editor.setShowMoreOptionsLink(showMoreOptions != null);
|
||||
editor.setShowMoreOptionsLink(true);
|
||||
|
||||
final Balloon balloon = JBPopupFactory.getInstance()
|
||||
.createDialogBalloonBuilder(editor.getMainPanel(), null)
|
||||
@@ -250,6 +272,7 @@ public class DebuggerUIUtil {
|
||||
.setBlockClicksThroughBalloon(true)
|
||||
.createBalloon();
|
||||
|
||||
|
||||
editor.setDelegate(new BreakpointEditor.Delegate() {
|
||||
@Override
|
||||
public void done() {
|
||||
@@ -271,6 +294,8 @@ public class DebuggerUIUtil {
|
||||
balloon.show(new RelativePoint(component, whereToShow), Balloon.Position.below);
|
||||
}
|
||||
|
||||
BreakpointsMasterDetailPopupFactory.getInstance(project).setBalloonToHide(balloon);
|
||||
|
||||
return balloon;
|
||||
}
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ public class GitUtil {
|
||||
if ((!firstStep) && lineIsAStart) {
|
||||
final StringScanner innerScanner = new StringScanner(sb.toString());
|
||||
sb.setLength(0);
|
||||
consumer.consume(GitChangeUtils.parseChangeList(project, root, innerScanner, skipDiffsForMerge, h));
|
||||
consumer.consume(GitChangeUtils.parseChangeList(project, root, innerScanner, skipDiffsForMerge, h, false));
|
||||
}
|
||||
sb.append(lineIsAStart ? line.substring(2) : line).append('\n');
|
||||
firstStep = false;
|
||||
@@ -516,7 +516,7 @@ public class GitUtil {
|
||||
if (sb.length() > 0) {
|
||||
final StringScanner innerScanner = new StringScanner(sb.toString());
|
||||
sb.setLength(0);
|
||||
consumer.consume(GitChangeUtils.parseChangeList(project, root, innerScanner, skipDiffsForMerge, h));
|
||||
consumer.consume(GitChangeUtils.parseChangeList(project, root, innerScanner, skipDiffsForMerge, h, false));
|
||||
}
|
||||
if (s.hasMoreData()) {
|
||||
throw new IllegalStateException("More input is avaialble: " + s.line());
|
||||
|
||||
@@ -86,7 +86,7 @@ public class GitShowAllSubmittedFilesAction extends AnAction implements DumbAwar
|
||||
* @param file file affected by the revision
|
||||
*/
|
||||
public static void showSubmittedFiles(final Project project, final VcsFileRevision revision, final VirtualFile file) {
|
||||
showSubmittedFiles(project, revision.getRevisionNumber().asString(), file);
|
||||
showSubmittedFiles(project, revision.getRevisionNumber().asString(), file, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,14 +95,15 @@ public class GitShowAllSubmittedFilesAction extends AnAction implements DumbAwar
|
||||
* @param project a project
|
||||
* @param revision a revision number
|
||||
* @param file file affected by the revision
|
||||
* @param local
|
||||
*/
|
||||
public static void showSubmittedFiles(final Project project, final String revision, final VirtualFile file) {
|
||||
public static void showSubmittedFiles(final Project project, final String revision, final VirtualFile file, final boolean local) {
|
||||
new Task.Backgroundable(project, GitBundle.message("changes.retrieving", revision)) {
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
indicator.setIndeterminate(true);
|
||||
try {
|
||||
VirtualFile vcsRoot = GitUtil.getGitRoot(file);
|
||||
final CommittedChangeList changeList = GitChangeUtils.getRevisionChanges(project, vcsRoot, revision, true);
|
||||
final CommittedChangeList changeList = GitChangeUtils.getRevisionChanges(project, vcsRoot, revision, true, local);
|
||||
if (changeList != null) {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class GitChangeUtils {
|
||||
public static void parseChanges(Project project,
|
||||
VirtualFile vcsRoot,
|
||||
@Nullable GitRevisionNumber thisRevision,
|
||||
GitRevisionNumber parentRevision,
|
||||
@Nullable GitRevisionNumber parentRevision,
|
||||
StringScanner s,
|
||||
Collection<Change> changes,
|
||||
final Set<String> ignoreNames) throws VcsException {
|
||||
@@ -230,14 +230,20 @@ public class GitChangeUtils {
|
||||
* of the merge, so changes are reported as difference with the first revision
|
||||
* listed on the the merge that has at least some changes.
|
||||
*
|
||||
*
|
||||
* @param project the project file
|
||||
* @param root the git root
|
||||
* @param revisionName the name of revision (might be tag)
|
||||
* @param skipDiffsForMerge
|
||||
* @param local
|
||||
* @return change list for the respective revision
|
||||
* @throws VcsException in case of problem with running git
|
||||
*/
|
||||
public static GitCommittedChangeList getRevisionChanges(Project project, VirtualFile root, String revisionName, boolean skipDiffsForMerge) throws VcsException {
|
||||
public static GitCommittedChangeList getRevisionChanges(Project project,
|
||||
VirtualFile root,
|
||||
String revisionName,
|
||||
boolean skipDiffsForMerge,
|
||||
boolean local) throws VcsException {
|
||||
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.SHOW);
|
||||
h.setNoSSH(true);
|
||||
h.setSilent(true);
|
||||
@@ -245,7 +251,7 @@ public class GitChangeUtils {
|
||||
revisionName, "--");
|
||||
String output = h.run();
|
||||
StringScanner s = new StringScanner(output);
|
||||
return parseChangeList(project, root, s, skipDiffsForMerge, h);
|
||||
return parseChangeList(project, root, s, skipDiffsForMerge, h, local);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -328,15 +334,24 @@ public class GitChangeUtils {
|
||||
/**
|
||||
* Parse changelist
|
||||
*
|
||||
*
|
||||
* @param project the project
|
||||
* @param root the git root
|
||||
* @param s the scanner for log or show command output
|
||||
* @param skipDiffsForMerge
|
||||
* @param handler the handler that produced the output to parse. - for debugging purposes.
|
||||
* @param local pass {@code true} to indicate that this revision should be an editable
|
||||
* {@link com.intellij.openapi.vcs.changes.CurrentContentRevision}.
|
||||
* Pass {@code false} for
|
||||
* @return the parsed changelist
|
||||
* @throws VcsException if there is a problem with running git
|
||||
*/
|
||||
public static GitCommittedChangeList parseChangeList(Project project, VirtualFile root, StringScanner s, boolean skipDiffsForMerge, GitHandler handler) throws VcsException {
|
||||
public static GitCommittedChangeList parseChangeList(Project project,
|
||||
VirtualFile root,
|
||||
StringScanner s,
|
||||
boolean skipDiffsForMerge,
|
||||
GitHandler handler,
|
||||
boolean local) throws VcsException {
|
||||
ArrayList<Change> changes = new ArrayList<Change>();
|
||||
// parse commit information
|
||||
final Date commitDate = GitUtil.parseTimestampWithNFEReport(s.line(), handler, s.getAllText());
|
||||
@@ -367,7 +382,7 @@ public class GitChangeUtils {
|
||||
final GitRevisionNumber parentRevision = parents.length > 0 ? loadRevision(project, root, parents[0]) : null;
|
||||
// This is the first or normal commit with the single parent.
|
||||
// Just parse changes in this commit as returned by the show command.
|
||||
parseChanges(project, root, thisRevision, parentRevision, s, changes, null);
|
||||
parseChanges(project, root, thisRevision, local ? null : parentRevision, s, changes, null);
|
||||
}
|
||||
else {
|
||||
// This is the merge commit. It has multiple parent commits.
|
||||
@@ -376,10 +391,6 @@ public class GitChangeUtils {
|
||||
|
||||
for (String parent : parents) {
|
||||
final GitRevisionNumber parentRevision = loadRevision(project, root, parent);
|
||||
if (parentRevision == null) {
|
||||
// the repository was cloned with --depth parameter
|
||||
continue;
|
||||
}
|
||||
GitSimpleHandler diffHandler = new GitSimpleHandler(project, root, GitCommand.DIFF);
|
||||
diffHandler.setNoSSH(true);
|
||||
diffHandler.setSilent(true);
|
||||
|
||||
@@ -133,7 +133,7 @@ public class GitRebaseEditor extends DialogWrapper {
|
||||
return;
|
||||
}
|
||||
GitRebaseEntry entry = myTableModel.myEntries.get(row);
|
||||
GitShowAllSubmittedFilesAction.showSubmittedFiles(project, entry.getCommit(), gitRoot);
|
||||
GitShowAllSubmittedFilesAction.showSubmittedFiles(project, entry.getCommit(), gitRoot, false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class GitReferenceValidator {
|
||||
myLastResult = false;
|
||||
try {
|
||||
GitRevisionNumber revision = GitRevisionNumber.resolve(myProject, gitRoot(), revisionExpression);
|
||||
GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, revision.asString(), gitRoot());
|
||||
GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, revision.asString(), gitRoot(), false);
|
||||
myLastResult = true;
|
||||
}
|
||||
catch (VcsException ex) {
|
||||
|
||||
@@ -124,6 +124,7 @@ public class GitUnstashDialog extends DialogWrapper {
|
||||
*/
|
||||
public GitUnstashDialog(final Project project, final List<VirtualFile> roots, final VirtualFile defaultRoot) {
|
||||
super(project, true);
|
||||
setModal(false);
|
||||
myProject = project;
|
||||
myVcs = GitVcs.getInstance(project);
|
||||
setTitle(GitBundle.getString("unstash.title"));
|
||||
@@ -223,7 +224,7 @@ public class GitUnstashDialog extends DialogWrapper {
|
||||
GitUIUtil.showOperationError(myProject, ex, "resolving revision");
|
||||
return;
|
||||
}
|
||||
GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, resolvedStash, root);
|
||||
GitShowAllSubmittedFilesAction.showSubmittedFiles(myProject, resolvedStash, root, true);
|
||||
}
|
||||
});
|
||||
init();
|
||||
|
||||
Reference in New Issue
Block a user