Skip to content

Commit

Permalink
Find/Replace overlay: move components into internal package
Browse files Browse the repository at this point in the history
moves helper classes for the find/replace overlay into an internal
package.
  • Loading branch information
Maximilian Wittmer authored and Maximilian Wittmer committed Jul 1, 2024
1 parent 769d5d1 commit 1253061
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Export-Package:
org.eclipse.ui.contentassist,
org.eclipse.ui.internal.findandreplace;x-friends:="org.eclipse.ui.workbench.texteditor.tests",
org.eclipse.ui.internal.findandreplace.status;x-friends:="org.eclipse.ui.workbench.texteditor.tests",
org.eclipse.ui.internal.findandreplace.overlay;x-friends:="org.eclipse.ui.workbench.texteditor.tests",
org.eclipse.ui.internal.texteditor;texteditor=split;mandatory:=texteditor;x-friends:="org.eclipse.ui.editors",
org.eclipse.ui.internal.texteditor.codemining;x-internal:=true,
org.eclipse.ui.internal.texteditor.quickdiff;x-internal:=true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.texteditor;
package org.eclipse.ui.internal.findandreplace.overlay;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.texteditor;
package org.eclipse.ui.internal.findandreplace.overlay;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.texteditor;
package org.eclipse.ui.internal.findandreplace.overlay;

import org.osgi.framework.FrameworkUtil;

Expand Down Expand Up @@ -54,6 +54,7 @@

import org.eclipse.jface.text.IFindReplaceTarget;
import org.eclipse.jface.text.IFindReplaceTargetExtension;
import org.eclipse.jface.text.ITextViewer;

import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPage;
Expand All @@ -64,10 +65,12 @@
import org.eclipse.ui.internal.findandreplace.SearchOptions;
import org.eclipse.ui.internal.findandreplace.status.IFindReplaceStatus;

import org.eclipse.ui.texteditor.StatusTextEditor;

/**
* @since 3.17
*/
class FindReplaceOverlay extends Dialog {
public class FindReplaceOverlay extends Dialog {

private static final String REPLACE_BAR_OPEN_DIALOG_SETTING = "replaceBarOpen"; //$NON-NLS-1$
private static final double WORST_CASE_RATIO_EDITOR_TO_OVERLAY = 0.95;
Expand Down Expand Up @@ -371,7 +374,7 @@ private void applyOverlayColors(Color color, boolean tryToColorReplaceBar) {
private void unbindListeners() {
getShell().removeShellListener(overlayDeactivationListener);
if (targetPart != null && targetPart instanceof StatusTextEditor textEditor) {
Control targetWidget = textEditor.getSourceViewer().getTextWidget();
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();
if (targetWidget != null) {
targetWidget.getShell().removeControlListener(shellMovementListener);
targetWidget.removePaintListener(widgetMovementListener);
Expand All @@ -383,7 +386,7 @@ private void unbindListeners() {
private void bindListeners() {
getShell().addShellListener(overlayDeactivationListener);
if (targetPart instanceof StatusTextEditor textEditor) {
Control targetWidget = textEditor.getSourceViewer().getTextWidget();
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();

targetWidget.getShell().addControlListener(shellMovementListener);
targetWidget.addPaintListener(widgetMovementListener);
Expand Down Expand Up @@ -779,7 +782,7 @@ private void positionToPart() {
}

StatusTextEditor textEditor = (StatusTextEditor) targetPart;
Control targetWidget = textEditor.getSourceViewer().getTextWidget();
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();
if (!okayToUse(targetWidget)) {
this.close();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.texteditor;
package org.eclipse.ui.internal.findandreplace.overlay;

import java.time.Duration;
import java.util.Objects;
Expand Down Expand Up @@ -42,7 +42,7 @@
* whether the popup was already shown and will only show the Overlay on the
* first time the popup was shown.
*/
class FindReplaceOverlayFirstTimePopup {
public class FindReplaceOverlayFirstTimePopup {

private FindReplaceOverlayFirstTimePopup() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.ui.texteditor;
package org.eclipse.ui.internal.findandreplace.overlay;

import java.net.URL;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.internal.findandreplace.overlay.FindReplaceOverlay;
import org.eclipse.ui.internal.findandreplace.overlay.FindReplaceOverlayFirstTimePopup;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public OverlayAccess openUIFromTextViewer(TextViewer viewer) {
new Object[] { ResourceBundle.getBundle("org.eclipse.ui.texteditor.ConstructedEditorMessages"), "Editor.FindReplace.", viewer.getControl().getShell(),
getTextViewer().getFindReplaceTarget() });
fFindReplaceAction.invoke("showOverlayInEditor", null);
Accessor overlayAccessor= new Accessor(fFindReplaceAction.get("overlay"), "org.eclipse.ui.texteditor.FindReplaceOverlay", getClass().getClassLoader());
Accessor overlayAccessor= new Accessor(fFindReplaceAction.get("overlay"), "org.eclipse.ui.internal.findandreplace.overlay.FindReplaceOverlay", getClass().getClassLoader());

ret= new OverlayAccess(overlayAccessor);
return ret;
Expand Down

0 comments on commit 1253061

Please sign in to comment.