ruby.ui: Remove redundant type specifications.
Enable warnings and save actions to automate cleanup.
Change-Id: I1a157ce68a06d1840f1dbddc43b0ccb00b05c896
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.core.prefs
index b87100e..3ddc8d3 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,9 +1,111 @@
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
diff --git a/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.ui.prefs
index 547a75e..2be769c 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.dltk.ruby.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,61 @@
-#Fri Oct 22 23:43:52 CEST 2010
eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=11
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_functional_interfaces=true
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java
index 3a19bdd..6edd550 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/docs/RiHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -19,7 +19,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Status;
-import org.eclipse.dltk.core.IShutdownListener;
import org.eclipse.dltk.core.environment.IDeployment;
import org.eclipse.dltk.core.environment.IEnvironment;
import org.eclipse.dltk.core.environment.IExecutionEnvironment;
@@ -48,7 +47,7 @@
return instance;
}
- private WeakHashMap<String, String> cache = new WeakHashMap<String, String>();
+ private WeakHashMap<String, String> cache = new WeakHashMap<>();
private Process riProcess;
private OutputStreamWriter writer;
@@ -66,8 +65,8 @@
}
}
- protected synchronized void runRiProcess() throws CoreException,
- IOException {
+ protected synchronized void runRiProcess()
+ throws CoreException, IOException {
IInterpreterInstall install = ScriptRuntime
.getDefaultInterpreterInstall(RubyNature.NATURE_ID,
LocalEnvironment.getInstance());
@@ -88,15 +87,15 @@
IFileHandle script = deployment.getFile(path);
- riProcess = ScriptLaunchUtil.runScriptWithInterpreter(exeEnv, install
- .getInstallLocation().toOSString(), script, null, null, null,
- install.getEnvironmentVariables());
+ riProcess = ScriptLaunchUtil.runScriptWithInterpreter(exeEnv,
+ install.getInstallLocation().toOSString(), script, null, null,
+ null, install.getEnvironmentVariables());
writer = new OutputStreamWriter(riProcess.getOutputStream());
- reader = new BufferedReader(new InputStreamReader(riProcess
- .getInputStream()));
- errorReader = new BufferedReader(new InputStreamReader(riProcess
- .getErrorStream()));
+ reader = new BufferedReader(
+ new InputStreamReader(riProcess.getInputStream()));
+ errorReader = new BufferedReader(
+ new InputStreamReader(riProcess.getErrorStream()));
}
protected synchronized void destroyRiProcess() {
@@ -115,14 +114,7 @@
if (riProcess != null) {
try {
final Watchdog watchdog = new Watchdog(TERMINATE_WAIT_TIMEOUT);
- watchdog.addListener(new WatchdogListener() {
-
- @Override
- public void timeoutOccured() {
- riProcess.destroy();
- }
-
- });
+ watchdog.addListener(() -> riProcess.destroy());
watchdog.start();
try {
riProcess.waitFor();
@@ -215,8 +207,8 @@
}
protected RiHelper() {
- ScriptRuntime
- .addInterpreterInstallChangedListener(new IInterpreterInstallChangedListener() {
+ ScriptRuntime.addInterpreterInstallChangedListener(
+ new IInterpreterInstallChangedListener() {
@Override
public void defaultInterpreterInstallChanged(
IInterpreterInstall previous,
@@ -225,7 +217,8 @@
}
@Override
- public void interpreterAdded(IInterpreterInstall Interpreter) {
+ public void interpreterAdded(
+ IInterpreterInstall Interpreter) {
}
@Override
@@ -237,14 +230,7 @@
IInterpreterInstall Interpreter) {
}
});
- RubyUI.getDefault().addShutdownListener(new IShutdownListener() {
-
- @Override
- public void shutdown() {
- destroyRiProcess();
- }
-
- });
+ RubyUI.getDefault().addShutdownListener(() -> destroyRiProcess());
}
public synchronized String getDocFor(String keyword) {
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyDocumentationProvider.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyDocumentationProvider.java
index 875ae8f..890e6c6 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyDocumentationProvider.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/documentation/RubyDocumentationProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -54,7 +54,7 @@
/**
* Installs a partitioner with <code>document</code>.
- *
+ *
* @param document
* the document
*/
@@ -73,13 +73,13 @@
/**
* Removes partitioner with <code>document</code>.
- *
+ *
* @param document
* the document
*/
private static void removeStuff(Document document) {
- document
- .setDocumentPartitioner(IRubyPartitions.RUBY_PARTITIONING, null);
+ document.setDocumentPartitioner(IRubyPartitions.RUBY_PARTITIONING,
+ null);
}
private static int findOffsetBeforeMethod(Document doc, int start)
@@ -101,11 +101,11 @@
if (PUBLIC.equals(s) || PROTECTED.equals(s) || PRIVATE.equals(s)) {
/**
* skip access modifiers between method and comment, e.g.
- *
+ *
* <code>
- * # foo-method documentation
- * public
- * def foo
+ * # foo-method documentation
+ * public
+ * def foo
* end
* </code>
*/
@@ -130,14 +130,13 @@
while (pos >= 0 && pos <= doc.getLength()) {
ITypedRegion region = TextUtilities.getPartition(doc,
IRubyPartitions.RUBY_PARTITIONING, pos, true);
- if (region.getType().equals(IRubyPartitions.RUBY_DOC)
- || region.getType()
- .equals(IRubyPartitions.RUBY_COMMENT)) {
+ if (region.getType().equals(IRubyPartitions.RUBY_DOC) || region
+ .getType().equals(IRubyPartitions.RUBY_COMMENT)) {
start = region.getOffset();
}
if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
- String content = doc.get(region.getOffset(),
- region.getLength()).trim();
+ String content = doc
+ .get(region.getOffset(), region.getLength()).trim();
if (content.length() > 0 && !content.startsWith("public") //$NON-NLS-1$
&& !content.startsWith("protected") //$NON-NLS-1$
&& !content.startsWith("private")) //$NON-NLS-1$
@@ -151,14 +150,13 @@
while (pos <= doc.getLength()) {
ITypedRegion region = TextUtilities.getPartition(doc,
IRubyPartitions.RUBY_PARTITIONING, pos, true);
- if (region.getType().equals(IRubyPartitions.RUBY_DOC)
- || region.getType()
- .equals(IRubyPartitions.RUBY_COMMENT)) {
+ if (region.getType().equals(IRubyPartitions.RUBY_DOC) || region
+ .getType().equals(IRubyPartitions.RUBY_COMMENT)) {
end = region.getOffset() + region.getLength();
}
if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
- String content = doc.get(region.getOffset(),
- region.getLength()).trim();
+ String content = doc
+ .get(region.getOffset(), region.getLength()).trim();
if (content.length() > 0 && !content.startsWith("public") //$NON-NLS-1$
&& !content.startsWith("protected") //$NON-NLS-1$
&& !content.startsWith("private")) //$NON-NLS-1$
@@ -252,7 +250,8 @@
@Override
public Reader getInfo(IMember member, boolean lookIntoParents,
boolean lookIntoExternal) {
- boolean isBuiltin = member.getAncestor(IModelElement.PROJECT_FRAGMENT) instanceof BuiltinProjectFragment;
+ boolean isBuiltin = member.getAncestor(
+ IModelElement.PROJECT_FRAGMENT) instanceof BuiltinProjectFragment;
if (isBuiltin && member instanceof IMethod) {
IMethod method = (IMethod) member;
return proccessBuiltinMethod(method);
@@ -271,7 +270,8 @@
return new StringReader(convertToHTML(header));
}
- private static String replaceSpecTag(String original, String sc, String tag) {
+ private static String replaceSpecTag(String original, String sc,
+ String tag) {
String filtered = original;
if (sc.equals("*") || sc.equals("+")) //$NON-NLS-1$ //$NON-NLS-2$
sc = "\\" + sc; //$NON-NLS-1$
@@ -360,7 +360,7 @@
/**
* Checks if a String is whitespace, empty ("") or null.
- *
+ *
* @param str
* the String to check, may be null
* @return <code>true</code> if the String is null, empty or whitespace
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java
index 43f917f..7a4841b 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/editor/RubyOutlinePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -38,19 +38,20 @@
fOutlineViewer, fStore);
String title, helpContext;
- ArrayList<MemberFilterAction> actions = new ArrayList<MemberFilterAction>(3);
+ ArrayList<MemberFilterAction> actions = new ArrayList<>(
+ 3);
// Hide variables
title = ActionMessages.MemberFilterActionGroup_hide_variables_label;
helpContext = "";// IDLTKHelpContextIds.FILTER_FIELDS_ACTION; //$NON-NLS-1$
MemberFilterAction hideVariables = new MemberFilterAction(
- fMemberFilterActionGroup, title, new ModelElementFilter(
- IModelElement.FIELD), helpContext, true);
- hideVariables
- .setDescription(ActionMessages.MemberFilterActionGroup_hide_variables_description);
- hideVariables
- .setToolTipText(ActionMessages.MemberFilterActionGroup_hide_variables_tooltip);
+ fMemberFilterActionGroup, title,
+ new ModelElementFilter(IModelElement.FIELD), helpContext, true);
+ hideVariables.setDescription(
+ ActionMessages.MemberFilterActionGroup_hide_variables_description);
+ hideVariables.setToolTipText(
+ ActionMessages.MemberFilterActionGroup_hide_variables_tooltip);
DLTKPluginImages.setLocalImageDescriptors(hideVariables,
"filter_fields.gif"); //$NON-NLS-1$
actions.add(hideVariables);
@@ -59,12 +60,13 @@
title = ActionMessages.MemberFilterActionGroup_hide_functions_label;
helpContext = "";// IDLTKHelpContextIds.FILTER_STATIC_ACTION; //$NON-NLS-1$
MemberFilterAction hideProcedures = new MemberFilterAction(
- fMemberFilterActionGroup, title, new ModelElementFilter(
- IModelElement.METHOD), helpContext, true);
- hideProcedures
- .setDescription(ActionMessages.MemberFilterActionGroup_hide_functions_description);
- hideProcedures
- .setToolTipText(ActionMessages.MemberFilterActionGroup_hide_functions_tooltip);
+ fMemberFilterActionGroup, title,
+ new ModelElementFilter(IModelElement.METHOD), helpContext,
+ true);
+ hideProcedures.setDescription(
+ ActionMessages.MemberFilterActionGroup_hide_functions_description);
+ hideProcedures.setToolTipText(
+ ActionMessages.MemberFilterActionGroup_hide_functions_tooltip);
// TODO: add correct icon
DLTKPluginImages.setLocalImageDescriptors(hideProcedures,
"filter_methods.gif"); //$NON-NLS-1$
@@ -74,18 +76,19 @@
title = ActionMessages.MemberFilterActionGroup_hide_classes_label;
helpContext = "";// IDLTKHelpContextIds.FILTER_PUBLIC_ACTION; //$NON-NLS-1$
MemberFilterAction hideNamespaces = new MemberFilterAction(
- fMemberFilterActionGroup, title, new ModelElementFilter(
- IModelElement.TYPE), helpContext, true);
- hideNamespaces
- .setDescription(ActionMessages.MemberFilterActionGroup_hide_classes_description);
- hideNamespaces
- .setToolTipText(ActionMessages.MemberFilterActionGroup_hide_classes_tooltip);
+ fMemberFilterActionGroup, title,
+ new ModelElementFilter(IModelElement.TYPE), helpContext, true);
+ hideNamespaces.setDescription(
+ ActionMessages.MemberFilterActionGroup_hide_classes_description);
+ hideNamespaces.setToolTipText(
+ ActionMessages.MemberFilterActionGroup_hide_classes_tooltip);
DLTKPluginImages.setLocalImageDescriptors(hideNamespaces,
"filter_classes.gif"); //$NON-NLS-1$
actions.add(hideNamespaces);
// Adding actions to toobar
- MemberFilterAction[] fFilterActions = actions.toArray(new MemberFilterAction[actions.size()]);
+ MemberFilterAction[] fFilterActions = actions
+ .toArray(new MemberFilterAction[actions.size()]);
fMemberFilterActionGroup.setActions(fFilterActions);
fMemberFilterActionGroup.contributeToToolBar(toolBarManager);
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java
index 0d14bbc..6f9e1ad 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyCodeScanner.java
@@ -80,7 +80,7 @@
@Override
protected List<IRule> createRules() {
- List<IRule> rules = new ArrayList<IRule>();
+ List<IRule> rules = new ArrayList<>();
IToken keyword = getToken(IRubyColorConstants.RUBY_KEYWORD);
IToken keywordReturn = getToken(IRubyColorConstants.RUBY_KEYWORD_RETURN);
IToken other = getToken(IRubyColorConstants.RUBY_DEFAULT);
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyDocScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyDocScanner.java
index 9370c33..ad1abeb 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyDocScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyDocScanner.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.internal.ui.text;
@@ -40,7 +39,7 @@
@Override
protected List<IRule> createRules() {
- final List<IRule> rules = new ArrayList<IRule>();
+ final List<IRule> rules = new ArrayList<>();
final IToken topic = getToken(IRubyColorConstants.RUBY_DOC_TOPIC);
final IToken other = getToken(IRubyColorConstants.RUBY_DOC);
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java
index 0755db3..572b4bb 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyPartitionScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -49,7 +49,7 @@
rubyDoc = new Token(IRubyPartitions.RUBY_DOC);
- List<IPredicateRule> rules = new ArrayList<IPredicateRule>();
+ List<IPredicateRule> rules = new ArrayList<>();
rules.add(new RDocRule(rubyDoc));
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java
index 0fbfe3e..668bcbf 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySemanticUpdateWorker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -50,8 +50,8 @@
import org.eclipse.dltk.ui.editor.highlighting.SemanticHighlighting;
import org.eclipse.dltk.ui.preferences.PreferencesMessages;
-public class RubySemanticUpdateWorker extends ASTVisitor implements
- ISemanticHighlighter, ISemanticHighlighterExtension {
+public class RubySemanticUpdateWorker extends ASTVisitor
+ implements ISemanticHighlighter, ISemanticHighlighterExtension {
@Override
public SemanticHighlighting[] getSemanticHighlightings() {
@@ -138,9 +138,9 @@
handleEvaluatableExpression(node);
} else if (node instanceof CallExpression) {
final CallExpression call = (CallExpression) node;
- if (!(RubySyntaxUtils.isRubyOperator(call.getName()) || call
- .getReceiver() == null
- && RubyCodeScanner.isPseudoKeyword(call.getName()))) {
+ if (!(RubySyntaxUtils.isRubyOperator(call.getName())
+ || call.getReceiver() == null && RubyCodeScanner
+ .isPseudoKeyword(call.getName()))) {
final SimpleReference callName = call.getCallName();
if (callName.sourceStart() >= 0
&& callName.sourceEnd() > callName.sourceStart()) {
@@ -182,7 +182,7 @@
stack.pop();
}
- private final Stack<ASTNode> stack = new Stack<ASTNode>();
+ private final Stack<ASTNode> stack = new Stack<>();
private void handleVariableReference(VariableReference ref) {
final String varName = ref.getName();
@@ -240,8 +240,8 @@
&& content[end] == terminator) {
start -= 3;
++end;
- while (end < content.length
- && RubySyntaxUtils.isValidRegexpModifier(content[end])) {
+ while (end < content.length && RubySyntaxUtils
+ .isValidRegexpModifier(content[end])) {
++end;
}
}
@@ -251,7 +251,7 @@
@Override
public String[] getHighlightingKeys() {
- final Set<String> result = new HashSet<String>();
+ final Set<String> result = new HashSet<>();
for (SemanticHighlighting highlighting : getSemanticHighlightings()) {
result.add(highlighting.getPreferenceKey());
}
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java
index c2a8c9e..91bac40 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySingleQuoteStringScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -11,7 +11,6 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.dltk.ruby.internal.ui.text.IRubyColorConstants;
import org.eclipse.dltk.ui.text.AbstractScriptScanner;
import org.eclipse.dltk.ui.text.IColorManager;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -20,7 +19,8 @@
public class RubySingleQuoteStringScanner extends AbstractScriptScanner {
- private static final String[] fgTokenProperties = new String[] { IRubyColorConstants.RUBY_STRING };
+ private static final String[] fgTokenProperties = new String[] {
+ IRubyColorConstants.RUBY_STRING };
public RubySingleQuoteStringScanner(IColorManager manager,
IPreferenceStore store) {
@@ -36,7 +36,7 @@
@Override
protected List<IRule> createRules() {
- List<IRule> rules = new ArrayList<IRule>();
+ List<IRule> rules = new ArrayList<>();
// Add generic whitespace rule.
rules.add(new WhitespaceRule(new RubyWhitespaceDetector()));
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySourceViewerConfiguration.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySourceViewerConfiguration.java
index 948b887..acaff70 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySourceViewerConfiguration.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubySourceViewerConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -7,13 +7,14 @@
*
* Contributors:
* xored software, Inc. - initial API and implementation
- * xored software, Inc. - fix tab handling (Bug# 200024) (Alex Panchenko)
+ * xored software, Inc. - fix tab handling (Bug# 200024) (Alex Panchenko)
*******************************************************************************/
package org.eclipse.dltk.ruby.internal.ui.text;
import java.util.Map;
import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.dltk.internal.ui.editor.EditorUtility;
import org.eclipse.dltk.internal.ui.editor.ScriptSourceViewer;
import org.eclipse.dltk.internal.ui.text.ScriptElementProvider;
@@ -29,7 +30,6 @@
import org.eclipse.jface.text.AbstractInformationControlManager;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
@@ -44,11 +44,10 @@
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.texteditor.ITextEditor;
-public class RubySourceViewerConfiguration extends
- ScriptSourceViewerConfiguration {
+public class RubySourceViewerConfiguration
+ extends ScriptSourceViewerConfiguration {
private RubyTextTools fTextTools;
@@ -108,8 +107,8 @@
public IPresentationReconciler getPresentationReconciler(
ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new ScriptPresentationReconciler();
- reconciler
- .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+ reconciler.setDocumentPartitioning(
+ getConfiguredDocumentPartitioning(sourceViewer));
DefaultDamagerRepairer dr = new DefaultDamagerRepairer(fCodeScanner);
reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
@@ -153,7 +152,7 @@
* Clients are not allowed to call this method if the old setup with text
* tools is in use.
* </p>
- *
+ *
* @param event
* the event to which to adapt
* @see RubySourceViewerConfiguration#ScriptSourceViewerConfiguration(IColorManager,
@@ -177,11 +176,11 @@
/**
* Determines whether the preference change encoded by the given event
* changes the behavior of one of its contained components.
- *
+ *
* @param event
* the event to be investigated
* @return <code>true</code> if event causes a behavioral change
- *
+ *
*/
@Override
public boolean affectsTextPresentation(PropertyChangeEvent event) {
@@ -194,14 +193,11 @@
private IInformationControlCreator getHierarchyPresenterControlCreator(
ISourceViewer sourceViewer) {
- return new IInformationControlCreator() {
- @Override
- public IInformationControl createInformationControl(Shell parent) {
- int shellStyle = SWT.RESIZE;
- int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
- return new RubyHierarchyInformationControl(parent, shellStyle,
- treeStyle);
- }
+ return parent -> {
+ int shellStyle = SWT.RESIZE;
+ int treeStyle = SWT.V_SCROLL | SWT.H_SCROLL;
+ return new RubyHierarchyInformationControl(parent, shellStyle,
+ treeStyle);
};
}
@@ -209,15 +205,15 @@
public IInformationPresenter getHierarchyPresenter(
ScriptSourceViewer sourceViewer, boolean doCodeResolve) {
// Do not create hierarchy presenter if there's no CU.
- if (getEditor() != null
- && getEditor().getEditorInput() != null
- && EditorUtility.getEditorInputModelElement(getEditor(), true) == null)
+ if (getEditor() != null && getEditor().getEditorInput() != null
+ && EditorUtility.getEditorInputModelElement(getEditor(),
+ true) == null)
return null;
InformationPresenter presenter = new InformationPresenter(
getHierarchyPresenterControlCreator(sourceViewer));
- presenter
- .setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+ presenter.setDocumentPartitioning(
+ getConfiguredDocumentPartitioning(sourceViewer));
presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
IInformationProvider provider = new ScriptElementProvider(getEditor(),
doCodeResolve);
@@ -229,11 +225,12 @@
}
@Override
- public IAutoEditStrategy[] getAutoEditStrategies(
- ISourceViewer sourceViewer, String contentType) {
+ public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer,
+ String contentType) {
// // TODO: check contentType. think, do we really need it? :)
String partitioning = getConfiguredDocumentPartitioning(sourceViewer);
- return new IAutoEditStrategy[] { new RubyAutoEditStrategy(partitioning) };
+ return new IAutoEditStrategy[] {
+ new RubyAutoEditStrategy(partitioning) };
}
@Override
@@ -254,8 +251,10 @@
}
@Override
- protected Map getHyperlinkDetectorTargets(final ISourceViewer sourceViewer) {
- final Map targets = super.getHyperlinkDetectorTargets(sourceViewer);
+ protected Map<String, IAdaptable> getHyperlinkDetectorTargets(
+ final ISourceViewer sourceViewer) {
+ final Map<String, IAdaptable> targets = super.getHyperlinkDetectorTargets(
+ sourceViewer);
targets.put("org.eclipse.dltk.ruby.code", getEditor()); //$NON-NLS-1$
return targets;
}
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyStringScanner.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyStringScanner.java
index 6feef70..562c405 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyStringScanner.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/RubyStringScanner.java
@@ -1,11 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
* http://www.eclipse.org/legal/epl-v10.html
*
-
*******************************************************************************/
package org.eclipse.dltk.ruby.internal.ui.text;
@@ -40,7 +39,7 @@
@Override
protected List<IRule> createRules() {
- List<IRule> rules = new ArrayList<IRule>();
+ List<IRule> rules = new ArrayList<>();
// Add generic whitespace rule.
rules.add(new WhitespaceRule(new RubyWhitespaceDetector()));
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java
index 9bc9c19..d40279a 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/folding/RubyFoldingStructureProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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
@@ -31,8 +31,8 @@
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.rules.IPartitionTokenScanner;
-public class RubyFoldingStructureProvider extends
- AbstractASTFoldingStructureProvider {
+public class RubyFoldingStructureProvider
+ extends AbstractASTFoldingStructureProvider {
@Override
protected String getCommentPartition() {
@@ -95,8 +95,8 @@
@Override
protected void initializePreferences(IPreferenceStore store) {
super.initializePreferences(store);
- fInitCollapseRequires = store
- .getBoolean(RubyPreferenceConstants.EDITOR_FOLDING_INIT_REQUIRES);
+ fInitCollapseRequires = store.getBoolean(
+ RubyPreferenceConstants.EDITOR_FOLDING_INIT_REQUIRES);
}
/**
@@ -107,7 +107,7 @@
protected static class RubyFoldingASTVisitor extends FoldingASTVisitor {
static class DeclarationContainer {
- final List<Object> children = new ArrayList<Object>();
+ final List<Object> children = new ArrayList<>();
final Declaration declaration;
final boolean foldAlways;
@@ -134,7 +134,7 @@
static class ModuleDeclarationContainer extends DeclarationContainer {
- final List<CallExpression> requires = new ArrayList<CallExpression>();
+ final List<CallExpression> requires = new ArrayList<>();
public ModuleDeclarationContainer() {
super(null, false);
@@ -146,7 +146,7 @@
}
- private final Stack<DeclarationContainer> declarations = new Stack<DeclarationContainer>();
+ private final Stack<DeclarationContainer> declarations = new Stack<>();
private DeclarationContainer peekDeclaration() {
return declarations.peek();
@@ -195,7 +195,8 @@
@Override
public boolean visit(MethodDeclaration s) throws Exception {
handleRequireStatements();
- final DeclarationContainer child = new DeclarationContainer(s, true);
+ final DeclarationContainer child = new DeclarationContainer(s,
+ true);
peekDeclaration().addChild(child);
declarations.push(child);
return visitGeneral(s);
@@ -218,8 +219,8 @@
for (Iterator<?> i = container.children.iterator(); i.hasNext();) {
final Object child = i.next();
if (child instanceof DeclarationContainer) {
- processDeclarations((DeclarationContainer) child,
- level + 1, nextCollabsible);
+ processDeclarations((DeclarationContainer) child, level + 1,
+ nextCollabsible);
} else if (child instanceof CodeBlock) {
add((CodeBlock) child);
}
@@ -260,8 +261,8 @@
final CallExpression lastRequire = container.requires
.get(container.requires.size() - 1);
container.addChild(new CodeBlock(firstRequire, new Region(
- firstRequire.sourceStart(), lastRequire.sourceEnd()
- - firstRequire.sourceStart())));
+ firstRequire.sourceStart(),
+ lastRequire.sourceEnd() - firstRequire.sourceStart())));
container.requires.clear();
}
}
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java
index d7d6eba..e6ee5df 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/RubyRequireHyperlink.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -38,7 +38,8 @@
private final IRegion region;
private final ITextEditor editor;
- public RubyRequireHyperlink(String path, IRegion region, ITextEditor editor) {
+ public RubyRequireHyperlink(String path, IRegion region,
+ ITextEditor editor) {
this.path = path;
this.region = region;
this.editor = editor;
@@ -75,15 +76,15 @@
private static final String DEFAULT_EXTENSION = ".rb"; //$NON-NLS-1$
private void doOpen() throws ModelException {
- final IModelElement input = EditorUtility.getEditorInputModelElement(
- editor, false);
+ final IModelElement input = EditorUtility
+ .getEditorInputModelElement(editor, false);
if (input != null) {
final OpenAction openAction = (OpenAction) editor
.getAction("OpenEditor"); //$NON-NLS-1$
if (openAction != null) {
final IScriptProject project = input.getScriptProject();
- final ISourceModule[] modules = SourceModuleLookup.lookup(
- project, path, DEFAULT_EXTENSION);
+ final ISourceModule[] modules = SourceModuleLookup
+ .lookup(project, path, DEFAULT_EXTENSION);
if (modules.length > 0) {
if (modules.length == 1) {
openAction.run(modules);
@@ -94,7 +95,8 @@
}
}
} else {
- showMessage(RubyHyperlinkMessages.RequireHyperlink_BadSelection);
+ showMessage(
+ RubyHyperlinkMessages.RequireHyperlink_BadSelection);
}
}
}
@@ -113,7 +115,7 @@
if (dialog.open() == Window.OK) {
final Object[] selection = dialog.getResult();
if (selection != null && selection.length > 0) {
- final List<ISourceModule> result = new ArrayList<ISourceModule>();
+ final List<ISourceModule> result = new ArrayList<>();
for (int i = 0, size = selection.length; i < size; i++) {
final Object current = selection[i];
if (current instanceof ISourceModule) {
diff --git a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java
index 4e65745..0c9c3ef 100644
--- a/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java
+++ b/plugins/org.eclipse.dltk.ruby.ui/src/org/eclipse/dltk/ruby/internal/ui/text/hyperlink/SourceModuleLookup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 xored software, Inc.
+ * Copyright (c) 2008, 2017 xored software, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,7 +26,7 @@
/**
* Lookups {@link ISourceModule}s with the specified
* <code>modulePath</code>. Returns the array of the matched modules.
- *
+ *
* @param project
* project to lookup
* @param modulePath
@@ -38,7 +38,7 @@
*/
public static ISourceModule[] lookup(IScriptProject project,
String modulePath, String suffix) throws ModelException {
- final List<ISourceModule> result = new ArrayList<ISourceModule>();
+ final List<ISourceModule> result = new ArrayList<>();
final IPath path = new Path(modulePath);
final String fileName = path.lastSegment();
final String folderPath = path.removeLastSegments(1).toString();