File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed
Program-Slicer-Plugin/src/programslicerplugin Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change 3
3
import org .eclipse .swt .custom .StyleRange ;
4
4
5
5
public class DefaultStyle {
6
- public static StyleRange [] DEFAULTSTYLEDTEXTRANGES ;
6
+ public static StyleRange [] DEFAULTSTYLEDTEXTRANGES = null ;
7
7
8
8
}
Original file line number Diff line number Diff line change @@ -144,7 +144,11 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
144
144
145
145
ITextViewer viewer = (ITextViewer ) iPart .getAdapter (ITextOperationTarget .class );
146
146
StyledText styledText = viewer .getTextWidget ();
147
- DefaultStyle .DEFAULTSTYLEDTEXTRANGES = styledText .getStyleRanges ();
147
+
148
+ if (DefaultStyle .DEFAULTSTYLEDTEXTRANGES == null ) {
149
+ DefaultStyle .DEFAULTSTYLEDTEXTRANGES = styledText .getStyleRanges ();
150
+ }
151
+
148
152
149
153
Display display = Display .getDefault ();
150
154
StyleRange style = new StyleRange ();
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
143
143
144
144
ITextViewer viewer = (ITextViewer ) iPart .getAdapter (ITextOperationTarget .class );
145
145
StyledText styledText = viewer .getTextWidget ();
146
- DefaultStyle .DEFAULTSTYLEDTEXTRANGES = styledText .getStyleRanges ();
146
+
147
+ if (DefaultStyle .DEFAULTSTYLEDTEXTRANGES == null ) {
148
+ DefaultStyle .DEFAULTSTYLEDTEXTRANGES = styledText .getStyleRanges ();
149
+ }
147
150
148
151
Display display = Display .getDefault ();
149
152
StyleRange style = new StyleRange ();
Original file line number Diff line number Diff line change @@ -18,15 +18,17 @@ public class ResetSlicingHandler extends AbstractHandler {
18
18
@ Override
19
19
public Object execute (ExecutionEvent event ) throws ExecutionException {
20
20
IWorkbenchWindow window = HandlerUtil .getActiveWorkbenchWindowChecked (event );
21
-
21
+
22
22
IWorkbenchPage iPage = window .getActivePage ();
23
23
IEditorPart iPart = iPage .getActiveEditor ();
24
-
24
+
25
25
ITextViewer viewer = (ITextViewer ) iPart .getAdapter (ITextOperationTarget .class );
26
-
26
+
27
27
StyledText styledText = viewer .getTextWidget ();
28
- styledText .setStyleRanges (DefaultStyle .DEFAULTSTYLEDTEXTRANGES );
29
-
28
+ if (DefaultStyle .DEFAULTSTYLEDTEXTRANGES != null ) {
29
+ styledText .setStyleRanges (DefaultStyle .DEFAULTSTYLEDTEXTRANGES );
30
+ }
31
+
30
32
return null ;
31
33
}
32
34
}
You can’t perform that action at this time.
0 commit comments