Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-07-19 08:52:49 -0400
committerAlexander Kurtakov2018-07-19 08:52:49 -0400
commit233a9f42db3dcb0a0eaebbe55a3c2574802b9805 (patch)
tree0787422f4289580540142302596cd67234e7e0d0 /org.eclipse.ui.console
parent8c924456a516ce49087a542b155ee70c8d76ae38 (diff)
downloadeclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.tar.gz
eclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.tar.xz
eclipse.platform.debug-233a9f42db3dcb0a0eaebbe55a3c2574802b9805.zip
Bug 521038 - [refactoring] Replace anonymous Runnable classes by lambda
expression Changed some formatters to Eclipse so there is some formatting happening as the debug one is not clear where to get from and it's unrealistic to expect random contributors to do it. Change-Id: I731410854f9a4ac0c9fc18bcf3ad3dcf7d941c9a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.ui.console')
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs81
-rw-r--r--org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs4
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java7
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java95
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java21
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java62
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java7
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java13
8 files changed, 138 insertions, 152 deletions
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
index 03a7213cd..568f4d675 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.core.prefs
@@ -138,31 +138,37 @@ org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL,HIGH,HIGH
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,EXPERIMENTAL,CONTEXTLAUNCHING
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=32
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=0
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=0
+org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@@ -182,19 +188,23 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true
+org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=80
@@ -207,7 +217,7 @@ org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -217,8 +227,9 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@@ -227,6 +238,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@@ -245,7 +257,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
@@ -274,6 +286,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@@ -351,6 +364,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@@ -405,18 +419,31 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
+org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
index 8e18452e3..aba901028 100644
--- a/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.ui.console/.settings/org.eclipse.jdt.ui.prefs
@@ -53,8 +53,8 @@ cleanup_profile=_Platform Debug Cleanups
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Platform Debug Formatting
-formatter_settings_version=12
+formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
+formatter_settings_version=14
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
index 8aaa63554..b10c84a1a 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsole.java
@@ -231,12 +231,7 @@ public abstract class TextConsole extends AbstractConsole {
if (fTabWidth != newTabWidth) {
final int oldTabWidth = fTabWidth;
fTabWidth = newTabWidth;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, Integer.valueOf(oldTabWidth), Integer.valueOf(fTabWidth));
- }
- });
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> firePropertyChange(TextConsole.this, IConsoleConstants.P_TAB_SIZE, Integer.valueOf(oldTabWidth), Integer.valueOf(fTabWidth)));
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
index ea849d651..d12f6f9e7 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/TextConsoleViewer.java
@@ -47,11 +47,8 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackListener;
-import org.eclipse.swt.events.MouseWheelListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
@@ -59,7 +56,6 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.internal.console.ConsoleDocumentAdapter;
import org.eclipse.ui.internal.console.ConsoleHyperlinkPosition;
@@ -107,18 +103,15 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
}
};
// event listener used to send event to hyperlink for IHyperlink2
- private Listener mouseUpListener = new Listener() {
- @Override
- public void handleEvent(Event event) {
- if (hyperlink != null) {
- String selection = getTextWidget().getSelectionText();
- if (selection.length() <= 0) {
- if (event.button == 1) {
- if (hyperlink instanceof IHyperlink2) {
- ((IHyperlink2) hyperlink).linkActivated(event);
- } else {
- hyperlink.linkActivated();
- }
+ private Listener mouseUpListener = event -> {
+ if (hyperlink != null) {
+ String selection = getTextWidget().getSelectionText();
+ if (selection.length() <= 0) {
+ if (event.button == 1) {
+ if (hyperlink instanceof IHyperlink2) {
+ ((IHyperlink2) hyperlink).linkActivated(event);
+ } else {
+ hyperlink.linkActivated();
}
}
}
@@ -197,25 +190,22 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
return false;
}
- private IPositionUpdater positionUpdater = new IPositionUpdater() {
- @Override
- public void update(DocumentEvent event) {
- try {
- IDocument document = getDocument();
- if (document != null) {
- Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
- for (int i = 0; i < positions.length; i++) {
- Position position = positions[i];
- if (position.offset == event.fOffset && position.length<=event.fLength) {
- position.delete();
- }
- if (position.isDeleted) {
- document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position);
- }
+ private IPositionUpdater positionUpdater = event -> {
+ try {
+ IDocument document = getDocument();
+ if (document != null) {
+ Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
+ for (int i = 0; i < positions.length; i++) {
+ Position position = positions[i];
+ if (position.offset == event.fOffset && position.length <= event.fLength) {
+ position.delete();
+ }
+ if (position.isDeleted) {
+ document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position);
}
}
- } catch (BadPositionCategoryException e) {
}
+ } catch (BadPositionCategoryException e) {
}
};
@@ -308,29 +298,23 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
}
}
});
- styledText.addMouseWheelListener(new MouseWheelListener() {
- @Override
- public void mouseScrolled(MouseEvent e) {
- if (isAutoScrollLockNotApplicable()) {
- return;
- }
- if (e.count < 0) { // Mouse dragged down
- if (checkEndOfDocument()) {
- setScrollLock(false);
- }
- } else if (!userHoldsScrollLock.get()) {
- setScrollLock(true);
+ styledText.addMouseWheelListener(e -> {
+ if (isAutoScrollLockNotApplicable()) {
+ return;
+ }
+ if (e.count < 0) { // Mouse dragged down
+ if (checkEndOfDocument()) {
+ setScrollLock(false);
}
+ } else if (!userHoldsScrollLock.get()) {
+ setScrollLock(true);
}
});
- styledText.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- // unlock the auto lock if user starts typing only if it was not manual lock
- if (scrollLockStateProvider != null && !scrollLockStateProvider.getScrollLock()) {
- setScrollLock(false);
- }
+ styledText.addVerifyListener(e -> {
+ // unlock the auto lock if user starts typing only if it was not manual lock
+ if (scrollLockStateProvider != null && !scrollLockStateProvider.getScrollLock()) {
+ setScrollLock(false);
}
});
@@ -702,12 +686,9 @@ public class TextConsoleViewer extends SourceViewer implements LineStyleListener
public void setConsoleWidth(int width) {
if (consoleWidth != width) {
consoleWidth = width;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (documentAdapter != null) {
- documentAdapter.setWidth(consoleWidth);
- }
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> {
+ if (documentAdapter != null) {
+ documentAdapter.setWidth(consoleWidth);
}
});
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
index f2f568714..2a31cae41 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/actions/ClearOutputAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,18 +79,15 @@ public class ClearOutputAction extends Action {
*/
@Override
public void run() {
- BusyIndicator.showWhile(ConsolePlugin.getStandardDisplay(), new Runnable() {
- @Override
- public void run() {
- if (fIOConsole == null) {
- IDocument document = fViewer.getDocument();
- if (document != null) {
- document.set(""); //$NON-NLS-1$
- }
- fViewer.setSelectedRange(0, 0);
- } else {
- fIOConsole.clearConsole();
+ BusyIndicator.showWhile(ConsolePlugin.getStandardDisplay(), () -> {
+ if (fIOConsole == null) {
+ IDocument document = fViewer.getDocument();
+ if (document != null) {
+ document.set(""); //$NON-NLS-1$
}
+ fViewer.setSelectedRange(0, 0);
+ } else {
+ fIOConsole.clearConsole();
}
});
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
index ab03b3adb..9fc2c526e 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleView.java
@@ -394,26 +394,23 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
@Override
public void consolesAdded(final IConsole[] consoles) {
if (isAvailable()) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- // ensure it's still registered since this is done asynchronously
- IConsole[] allConsoles = getConsoleManager().getConsoles();
- for (int j = 0; j < allConsoles.length; j++) {
- IConsole registered = allConsoles[j];
- if (registered.equals(console)) {
- ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
- fConsoleToPart.put(console, part);
- fPartToConsole.put(part, console);
- partActivated(part);
- break;
- }
+ Runnable r = () -> {
+ for (int i = 0; i < consoles.length; i++) {
+ if (isAvailable()) {
+ IConsole console = consoles[i];
+ // ensure it's still registered since this is done asynchronously
+ IConsole[] allConsoles = getConsoleManager().getConsoles();
+ for (int j = 0; j < allConsoles.length; j++) {
+ IConsole registered = allConsoles[j];
+ if (registered.equals(console)) {
+ ConsoleWorkbenchPart part = new ConsoleWorkbenchPart(console, getSite());
+ fConsoleToPart.put(console, part);
+ fPartToConsole.put(part, console);
+ partActivated(part);
+ break;
}
-
}
+
}
}
};
@@ -424,22 +421,19 @@ public class ConsoleView extends PageBookView implements IConsoleView, IConsoleL
@Override
public void consolesRemoved(final IConsole[] consoles) {
if (isAvailable()) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < consoles.length; i++) {
- if (isAvailable()) {
- IConsole console = consoles[i];
- fStack.remove(console);
- ConsoleWorkbenchPart part = fConsoleToPart.get(console);
- if (part != null) {
- partClosed(part);
- }
- if (getConsole() == null) {
- IConsole[] available = getConsoleManager().getConsoles();
- if (available.length > 0) {
- display(available[available.length - 1]);
- }
+ Runnable r = () -> {
+ for (int i = 0; i < consoles.length; i++) {
+ if (isAvailable()) {
+ IConsole console = consoles[i];
+ fStack.remove(console);
+ ConsoleWorkbenchPart part = fConsoleToPart.get(console);
+ if (part != null) {
+ partClosed(part);
+ }
+ if (getConsole() == null) {
+ IConsole[] available = getConsoleManager().getConsoles();
+ if (available.length > 0) {
+ display(available[available.length - 1]);
}
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
index f71fab026..44fcca5b6 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsolePartitioner.java
@@ -135,12 +135,7 @@ public class IOConsolePartitioner implements IConsoleDocumentPartitioner, IDocum
public void setWaterMarks(int low, int high) {
lowWaterMark = low;
highWaterMark = high;
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- checkBufferSize();
- }
- });
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> checkBufferSize());
}
/**
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
index 432f86a6f..2c6799741 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/IOConsoleViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -139,13 +139,10 @@ public class IOConsoleViewer extends TextConsoleViewer {
* makes the associated text widget uneditable.
*/
public void setReadOnly() {
- ConsolePlugin.getStandardDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- StyledText text = getTextWidget();
- if (text != null && !text.isDisposed()) {
- text.setEditable(false);
- }
+ ConsolePlugin.getStandardDisplay().asyncExec(() -> {
+ StyledText text = getTextWidget();
+ if (text != null && !text.isDisposed()) {
+ text.setEditable(false);
}
});
}

Back to the top