From 7d16ae1bf1b87ad325171613933134099b746e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kroi=C3=9F=2C=20Florian?= Date: Thu, 28 Mar 2024 14:42:51 +0100 Subject: [PATCH] Remove left-overs for code completion in breakpoint properties --- .../BreakpointConditionEditor.java | 78 ------------------- .../propertypages/PythonBreakpointPage.java | 19 +---- 2 files changed, 1 insertion(+), 96 deletions(-) diff --git a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/BreakpointConditionEditor.java b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/BreakpointConditionEditor.java index cb836b0d89..7497e60d9f 100644 --- a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/BreakpointConditionEditor.java +++ b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/BreakpointConditionEditor.java @@ -6,8 +6,6 @@ */ package org.python.pydev.debug.ui.propertypages; -import java.util.Map; - import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugException; import org.eclipse.jface.resource.JFaceResources; @@ -18,21 +16,11 @@ import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.IUndoManager; import org.eclipse.jface.text.TextViewerUndoManager; -import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.AbstractHandler; -import org.eclipse.ui.commands.ExecutionException; -import org.eclipse.ui.commands.HandlerSubmission; -import org.eclipse.ui.commands.IHandler; -import org.eclipse.ui.commands.IWorkbenchCommandSupport; -import org.eclipse.ui.commands.Priority; -import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; import org.python.pydev.core.IPythonPartitions; import org.python.pydev.core.partition.PyPartitionScanner; import org.python.pydev.core.partition.PyPartitioner; @@ -47,7 +35,6 @@ public class BreakpointConditionEditor { private String fOldValue; private String fErrorMessage; - private HandlerSubmission submission; private IDocumentListener fDocumentListener; private PythonBreakpointPage fPage; @@ -77,12 +64,6 @@ public BreakpointConditionEditor(Composite parent, PythonBreakpointPage page) { IDocumentPartitioner partitioner = new PyPartitioner(new PyPartitionScanner(), IPythonPartitions.types); document.setDocumentPartitioner(partitioner); partitioner.connect(document); - /* - fViewer.configure(new DisplayViewerConfiguration() { - public IContentAssistProcessor getContentAssistantProcessor() { - return getCompletionProcessor(); - } - });*/ fViewer.setEditable(true); fViewer.setDocument(document); final IUndoManager undoManager = new TextViewerUndoManager(100); @@ -108,47 +89,12 @@ public void documentChanged(DocumentEvent event) { }; fViewer.getDocument().addDocumentListener(fDocumentListener); - // we can only do code assist if there is an associated type - /* - try { - //getCompletionProcessor().setType(type); - String source= null; - ICompilationUnit compilationUnit= type.getCompilationUnit(); - if (compilationUnit != null) { - source= compilationUnit.getSource(); - } else { - IClassFile classFile= type.getClassFile(); - if (classFile != null) { - source= classFile.getSource(); - } - } - int lineNumber= fBreakpoint.getMarker().getAttribute(IMarker.LINE_NUMBER, -1); - int position= -1; - if (source != null && lineNumber != -1) { - try { - position= new Document(source).getLineOffset(lineNumber - 1); - } catch (BadLocationException e) { - } - } - //getCompletionProcessor().setPosition(position); - } catch (CoreException e) { - }*/ - gd = (GridData) fViewer.getControl().getLayoutData(); gd.heightHint = fPage.convertHeightInCharsToPixels(10); gd.widthHint = fPage.convertWidthInCharsToPixels(40); document.set(condition); valueChanged(); - IHandler handler = new AbstractHandler() { - @Override - public Object execute(Map parameter) throws ExecutionException { - fViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); - return null; - } - }; - submission = new HandlerSubmission(null, parent.getShell(), null, - ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS, handler, Priority.MEDIUM); } /** @@ -178,18 +124,6 @@ protected void refreshValidState() { } } - /** - * Return the completion processor associated with this viewer. - * @return BreakPointConditionCompletionProcessor - */ - /* - protected BreakpointConditionCompletionProcessor getCompletionProcessor() { - if (fCompletionProcessor == null) { - fCompletionProcessor= new BreakpointConditionCompletionProcessor(null); - } - return fCompletionProcessor; - }*/ - /** * @see org.eclipse.jface.preference.FieldEditor#setEnabled(boolean, org.eclipse.swt.widgets.Composite) */ @@ -199,16 +133,9 @@ public void setEnabled(boolean enabled) { if (enabled) { fViewer.updateViewerColors(); fViewer.getTextWidget().setFocus(); - - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchCommandSupport commandSupport = workbench.getCommandSupport(); - commandSupport.addHandlerSubmission(submission); } else { Color color = fViewer.getControl().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); fViewer.getTextWidget().setBackground(color); - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchCommandSupport commandSupport = workbench.getCommandSupport(); - commandSupport.removeHandlerSubmission(submission); } valueChanged(); } @@ -223,11 +150,6 @@ protected void valueChanged() { } public void dispose() { - if (fViewer.isEditable()) { - IWorkbench workbench = PlatformUI.getWorkbench(); - IWorkbenchCommandSupport commandSupport = workbench.getCommandSupport(); - commandSupport.removeHandlerSubmission(submission); - } fViewer.getDocument().removeDocumentListener(fDocumentListener); fViewer.dispose(); } diff --git a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/PythonBreakpointPage.java b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/PythonBreakpointPage.java index 7adbae15c6..dbd0b316ee 100644 --- a/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/PythonBreakpointPage.java +++ b/plugins/org.python.pydev.debug/src/org/python/pydev/debug/ui/propertypages/PythonBreakpointPage.java @@ -29,10 +29,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.commands.ICommand; -import org.eclipse.ui.commands.ICommandManager; -import org.eclipse.ui.commands.IKeySequenceBinding; import org.eclipse.ui.dialogs.PropertyPage; import org.eclipse.ui.model.IWorkbenchAdapter; import org.python.pydev.debug.core.PydevDebugPlugin; @@ -350,20 +346,7 @@ private void storeEnabled(PyBreakpoint breakpoint) throws CoreException { private void createConditionEditor(Composite parent) throws CoreException { PyBreakpoint breakpoint = getBreakpoint(); - String label = null; - ICommandManager commandManager = PlatformUI.getWorkbench().getCommandSupport().getCommandManager(); - ICommand command = commandManager.getCommand("org.eclipse.ui.edit.text.contentAssist.proposals"); //$NON-NLS-1$ - if (command != null) { - List keyBindings = command.getKeySequenceBindings(); - if (keyBindings != null && keyBindings.size() > 0) { - IKeySequenceBinding binding = (IKeySequenceBinding) keyBindings.get(0); - label = StringUtils.format("E&nable Condition %s", binding.getKeySequence().format()); //$NON-NLS-1$ - } - } - - if (label == null) { - label = "E&nable Condition (code assist not available)"; //$NON-NLS-1$ - } + String label = "E&nable Condition (code assist not available)"; Composite conditionComposite = new Group(parent, SWT.NONE); conditionComposite.setFont(parent.getFont()); conditionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));