-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring sticky lines provider and handler
Refactors the sticky lines provider and extract the method to an interface. This is a preparation step for providing a extension point for sticky lines provider.
- Loading branch information
1 parent
c603575
commit 0fa0c4b
Showing
6 changed files
with
142 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
....ui.editors/src/org/eclipse/ui/internal/texteditor/stickyscroll/IStickyLinesProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 SAP SE. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* SAP SE - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.ui.internal.texteditor.stickyscroll; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.swt.custom.StyledText; | ||
|
||
import org.eclipse.jface.text.source.ISourceViewer; | ||
|
||
/** | ||
* A sticky lines provider calculates the sticky lines for a given source viewer. The sticky lines | ||
* will be displayed in the top area of the editor. | ||
* | ||
* TODO move to public package and add since 3.19 | ||
*/ | ||
public interface IStickyLinesProvider { | ||
|
||
/** | ||
* Calculate the sticky lines for the source code of the given sourceViewer. Specific | ||
* properties, such as the <code>tabWidht</code> can be retrieved from the | ||
* <code>properties</code>. | ||
* | ||
* @param sourceViewer The source viewer containing the source code and information about the | ||
* first visible line | ||
* @return The list of sticky lines to show | ||
* | ||
* @see ISourceViewer#getTopIndex() | ||
* @see ISourceViewer#getTextWidget() | ||
* @see StyledText#getTopIndex() | ||
*/ | ||
public List<StickyLine> getStickyLines(ISourceViewer sourceViewer, StickyLinesProperties properties); | ||
|
||
/** | ||
* Properties required to calculate the sticky lines. | ||
* | ||
* @param tabWith The with of a tab | ||
*/ | ||
record StickyLinesProperties(int tabWith) { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.