tcl.ui: Modernize code a bit.
* ViewerSorter -> ViewerComparator.
* Enable save actions.
* Listener to Adapter when not all methods are implemented.
* Removed dead code.
Change-Id: I72a455367d67693b7d7c9c8e80f4b4cdc405ba49
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/.settings/org.eclipse.jdt.ui.prefs b/tcl/plugins/org.eclipse.dltk.tcl.ui/.settings/org.eclipse.jdt.ui.prefs
index 50fc54a..2be769c 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,61 @@
-#Fri Oct 22 23:45:34 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/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsBlock.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsBlock.java
index 8d15daa..57dafc3 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsBlock.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * 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
@@ -17,8 +17,8 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.dltk.tcl.ui.manpages.Documentation;
-import org.eclipse.dltk.tcl.ui.manpages.ManPageLoader;
import org.eclipse.dltk.tcl.ui.manpages.ManPageFolder;
+import org.eclipse.dltk.tcl.ui.manpages.ManPageLoader;
import org.eclipse.dltk.tcl.ui.manpages.ManPageResource;
import org.eclipse.dltk.ui.DLTKPluginImages;
import org.eclipse.dltk.ui.DLTKUIPlugin;
@@ -39,7 +39,7 @@
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
@@ -82,13 +82,14 @@
private final IStatusChangeListener fPage;
private final boolean fEditable;
- public ManPagesLocationsBlock(IStatusChangeListener page, boolean editable) {
+ public ManPagesLocationsBlock(IStatusChangeListener page,
+ boolean editable) {
fPage = page;
fEditable = editable;
}
- private static class ManPagesLabelProvider extends LabelProvider implements
- IFontProvider {
+ private static class ManPagesLabelProvider extends LabelProvider
+ implements IFontProvider {
public ManPagesLabelProvider() {
}
@@ -96,8 +97,8 @@
@Override
public Image getImage(Object element) {
if (element instanceof Documentation) {
- return DLTKUIPlugin.getImageDescriptorRegistry().get(
- DLTKPluginImages.DESC_OBJS_JAVADOCTAG);
+ return DLTKUIPlugin.getImageDescriptorRegistry()
+ .get(DLTKPluginImages.DESC_OBJS_JAVADOCTAG);
} else if (element instanceof ManPageFolder) {
return DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_LIBRARY);
} else {
@@ -125,8 +126,8 @@
if (element instanceof Documentation) {
final Documentation doc = (Documentation) element;
if (doc.isDefault()) {
- return JFaceResources.getFontRegistry().getBold(
- JFaceResources.DIALOG_FONT);
+ return JFaceResources.getFontRegistry()
+ .getBold(JFaceResources.DIALOG_FONT);
}
}
return null;
@@ -135,8 +136,8 @@
private ManPageResource documentations = null;
- private static class ManLocationsContentProvider implements
- ITreeContentProvider {
+ private static class ManLocationsContentProvider
+ implements ITreeContentProvider {
public ManLocationsContentProvider() {
}
@@ -173,14 +174,15 @@
public void dispose() {
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
}
};
/**
* Creates and returns the source lookup control.
- *
+ *
* @param parent
* the parent widget of this control
*/
@@ -201,7 +203,7 @@
fLocationsViewer.getControl().setLayoutData(gd);
fLocationsViewer.setContentProvider(new ManLocationsContentProvider());
fLocationsViewer.setLabelProvider(new ManPagesLabelProvider());
- fLocationsViewer.setSorter(new ViewerSorter());
+ fLocationsViewer.setComparator(new ViewerComparator());
fLocationsViewer.addSelectionChangedListener(this);
if (fEditable) {
createButtons(comp);
@@ -216,8 +218,8 @@
pathButtonLayout.marginHeight = 0;
pathButtonLayout.marginWidth = 0;
pathButtonComp.setLayout(pathButtonLayout);
- pathButtonComp.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_BEGINNING
+ pathButtonComp
+ .setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING
| GridData.HORIZONTAL_ALIGN_FILL));
fAddButton = createPushButton(pathButtonComp,
@@ -234,8 +236,8 @@
@Override
public void widgetSelected(SelectionEvent e) {
final IStructuredSelection selection = getSelection();
- if (selection.size() == 1
- && selection.getFirstElement() instanceof Documentation) {
+ if (selection.size() == 1 && selection
+ .getFirstElement() instanceof Documentation) {
edit((Documentation) selection.getFirstElement());
}
}
@@ -258,8 +260,8 @@
@Override
public void widgetSelected(SelectionEvent e) {
final IStructuredSelection selection = getSelection();
- if (selection.size() == 1
- && selection.getFirstElement() instanceof Documentation) {
+ if (selection.size() == 1 && selection
+ .getFirstElement() instanceof Documentation) {
setDefault((Documentation) selection.getFirstElement());
}
}
@@ -278,7 +280,7 @@
/**
* Creates and returns a button
- *
+ *
* @param parent
* parent widget
* @param label
@@ -341,7 +343,7 @@
/**
* Saves settings
- *
+ *
* @throws IOException
*/
public void save() throws IOException {
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsDialog.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsDialog.java
index 061c99e..598e317 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsDialog.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/documentation/ManPagesLocationsDialog.java
@@ -1,10 +1,10 @@
/*******************************************************************************
- * Copyright (c) 2009 xored software, Inc.
+ * Copyright (c) 2009, 2017 xored software, Inc. 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
+ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* xored software, Inc. - initial API and Implementation (Alex Panchenko)
@@ -43,7 +43,7 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -60,8 +60,8 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-public class ManPagesLocationsDialog extends StatusDialog implements
- ModifyListener {
+public class ManPagesLocationsDialog extends StatusDialog
+ implements ModifyListener {
private final boolean isNew;
private final ManPageResource documentations;
@@ -78,8 +78,9 @@
this.documentations = documentations;
this.input = documentation;
this.isNew = documentation == null;
- this.documentation = documentation != null ? (Documentation) EcoreUtil
- .copy(documentation) : newDocumentation();
+ this.documentation = documentation != null
+ ? (Documentation) EcoreUtil.copy(documentation)
+ : newDocumentation();
setTitle(isNew ? ManPagesMessages.ManPagesLocationsDialog_AddTtile
: ManPagesMessages.ManPagesLocationsDialog_EditTitle);
setShellStyle(getShellStyle() | SWT.RESIZE);
@@ -120,9 +121,8 @@
nameField.addModifyListener(this);
final Label pathLabel = new Label(content, SWT.NONE);
pathLabel.setText(ManPagesMessages.ManPagesLocationsDialog_Paths);
- pathLabel.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_BEGINNING
- | GridData.VERTICAL_ALIGN_BEGINNING));
+ pathLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
+ | GridData.VERTICAL_ALIGN_BEGINNING));
final Composite pathComp = new Composite(content, SWT.NONE);
pathComp.setLayoutData(new GridData(GridData.FILL_BOTH));
final GridLayout pathLayout = new GridLayout(2, false);
@@ -131,7 +131,7 @@
pathViewer = new TreeViewer(pathComp);
pathViewer.setContentProvider(new FolderContentProvider());
pathViewer.setLabelProvider(new FolderLabelProvider());
- pathViewer.setSorter(new ViewerSorter());
+ pathViewer.setComparator(new ViewerComparator());
final GridData pathGD = new GridData(GridData.FILL_BOTH);
pathGD.heightHint = convertHeightInCharsToPixels(16);
pathGD.widthHint = convertWidthInCharsToPixels(64);
@@ -170,9 +170,9 @@
}
});
- //
+ //
getData(documentation);
- //
+ //
return dialogArea;
}
@@ -215,7 +215,8 @@
public void dispose() {
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
}
}
@@ -240,8 +241,8 @@
if (element instanceof ManPageFolder) {
return DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_LIBRARY);
} else {
- return DLTKUIPlugin.getImageDescriptorRegistry().get(
- DLTKPluginImages.DESC_OBJS_INFO_OBJ);
+ return DLTKUIPlugin.getImageDescriptorRegistry()
+ .get(DLTKPluginImages.DESC_OBJS_INFO_OBJ);
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementListAdapterFactory.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementListAdapterFactory.java
index 9790900..ff383af 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementListAdapterFactory.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementListAdapterFactory.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.tcl.internal.ui.navigation;
@@ -14,16 +13,17 @@
import org.eclipse.dltk.tcl.internal.ui.navigation.ElementsView.ElementList;
public class ElementListAdapterFactory implements IAdapterFactory {
- private static Class[] PROPERTIES = new Class[] { IModelElement.class };
+ private static Class<?>[] PROPERTIES = new Class[] { IModelElement.class };
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return PROPERTIES;
}
- public Object getAdapter(Object element, Class key) {
+ @SuppressWarnings("unchecked")
+ public <T> T getAdapter(Object element, Class<T> key) {
if (IModelElement.class.equals(key)) {
if (element instanceof ElementList) {
- return ((ElementList) element).getFirstElement();
+ return (T) ((ElementList) element).getFirstElement();
}
}
return null;
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementsView.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementsView.java
index a0d9838..0b8c062 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementsView.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/ElementsView.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.tcl.internal.ui.navigation;
@@ -174,7 +173,7 @@
BusyIndicator.showWhile(treeViewer.getControl().getDisplay(),
new Runnable() {
public void run() {
- treeViewer.setSorter(on ? fSorter : null);
+ treeViewer.setComparator(on ? fSorter : null);
}
});
if (store)
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/PackageFilterAction.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/PackageFilterAction.java
index f10e4d8..5857618 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/PackageFilterAction.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/PackageFilterAction.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.tcl.internal.ui.navigation;
@@ -54,7 +53,8 @@
private IPreferenceStore fStore;
String preferenceKey;
- private class SimplePackagesContentProvider implements ITreeContentProvider {
+ private class SimplePackagesContentProvider
+ implements ITreeContentProvider {
private Object[] NO_ELEMENT = new Object[0];
protected Map elements = new HashMap();
@@ -89,20 +89,19 @@
public void dispose() {
}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
}
}
private class SimplePackageLabelProvider extends ScriptUILabelProvider
implements IBaseLabelProvider {
+ @Override
public Image getImage(Object element) {
return DLTKPluginImages.get(DLTKPluginImages.IMG_OBJS_PACKAGE);
}
- public String getOriginalText(Object element) {
- return super.getText(element);
- }
-
+ @Override
public String getText(Object element) {
if (element instanceof String)
return (String) element;
@@ -118,13 +117,13 @@
if (element instanceof IModelElement) {
if (viewer instanceof IFilterElementNameProvider) {
matchName = ((IFilterElementNameProvider) viewer)
- .getElementName((IModelElement) element);
+ .getElementName(element);
} else {
matchName = ((IModelElement) element).getElementName();
}
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- IModelElement modelElement = (IModelElement) adaptable
+ IModelElement modelElement = adaptable
.getAdapter(IModelElement.class);
if (modelElement != null)
if (viewer instanceof IFilterElementNameProvider) {
@@ -134,8 +133,7 @@
matchName = modelElement.getElementName();
}
else {
- IResource resource = (IResource) adaptable
- .getAdapter(IResource.class);
+ IResource resource = adaptable.getAdapter(IResource.class);
if (resource != null)
matchName = resource.getName();
}
@@ -170,10 +168,10 @@
List modelElements = null;
if (element instanceof IModelElement) {
modelElements = new ArrayList();
- modelElements.add((IModelElement) element);
+ modelElements.add(element);
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
- modelElements = (List) adaptable.getAdapter(List.class);
+ modelElements = adaptable.getAdapter(List.class);
}
List result = new ArrayList();
synchronized (modelElements) {
@@ -192,6 +190,7 @@
private class PackageFilter extends ViewerFilter {
List elements = new ArrayList();
+ @Override
public boolean select(Viewer viewer, Object parentElement,
Object element) {
IPackageDeclaration decl[] = getPackageDeclaration(element);
@@ -271,6 +270,7 @@
}
}
+ @Override
public void run() {
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/TclModelContentProvider.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/TclModelContentProvider.java
index f1e389e..86f8add 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/TclModelContentProvider.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/navigation/TclModelContentProvider.java
@@ -13,7 +13,6 @@
import org.eclipse.dltk.launching.ScriptRuntime;
import org.eclipse.dltk.tcl.internal.core.packages.TclPackageElement;
import org.eclipse.dltk.tcl.internal.core.packages.TclPackageFragment;
-import org.eclipse.dltk.tcl.internal.core.sources.TclSourcesElement;
import org.eclipse.dltk.tcl.internal.core.sources.TclSourcesFragment;
import org.eclipse.dltk.ui.IModelContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -30,8 +29,8 @@
if (parentElement instanceof BuildPathContainer) {
BuildPathContainer container = (BuildPathContainer) parentElement;
IBuildpathEntry entry = container.getBuildpathEntry();
- if (!entry.getPath().segment(0).equals(
- ScriptRuntime.INTERPRETER_CONTAINER)) {
+ if (!entry.getPath().segment(0)
+ .equals(ScriptRuntime.INTERPRETER_CONTAINER)) {
return;
}
@@ -82,8 +81,8 @@
if (children[i] instanceof BuildPathContainer) {
BuildPathContainer container = (BuildPathContainer) children[i];
IBuildpathEntry entry = container.getBuildpathEntry();
- if (entry.getPath().segment(0).equals(
- ScriptRuntime.INTERPRETER_CONTAINER)) {
+ if (entry.getPath().segment(0)
+ .equals(ScriptRuntime.INTERPRETER_CONTAINER)) {
return container;
}
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/preferences/TclCorePreferencePage.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/preferences/TclCorePreferencePage.java
index 718ba2d..33991c3 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/preferences/TclCorePreferencePage.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/preferences/TclCorePreferencePage.java
@@ -49,7 +49,6 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
@@ -60,8 +59,8 @@
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
@SuppressWarnings("restriction")
-public class TclCorePreferencePage extends
- AbstractConfigurationBlockPropertyAndPreferencePage {
+public class TclCorePreferencePage
+ extends AbstractConfigurationBlockPropertyAndPreferencePage {
private static int IDX_ADD = 0;
private static int IDX_EDIT = 1;
@@ -69,8 +68,8 @@
protected static class TclCorePreferenceBlock extends AbstractOptionsBlock {
- private class TclCheckContentAdapter implements IListAdapter,
- IDialogFieldListener {
+ private class TclCheckContentAdapter
+ implements IListAdapter, IDialogFieldListener {
private Set<String> contributedElements = null;
private final PreferenceKey listKey;
@@ -149,7 +148,7 @@
}
- private static class AssociationViwerSorter extends ViewerSorter {
+ private static class AssociationViwerSorter extends ViewerComparator {
private final Set<String> highlighted;
@@ -175,8 +174,8 @@
public Font getFont(Object element) {
if (highlighted.contains(element)) {
- return JFaceResources.getFontRegistry().getBold(
- JFaceResources.DIALOG_FONT);
+ return JFaceResources.getFontRegistry()
+ .getBold(JFaceResources.DIALOG_FONT);
}
return null;
}
@@ -207,8 +206,9 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- final IScriptProject[] projects = DLTKCore.create(
- ResourcesPlugin.getWorkspace().getRoot())
+ final IScriptProject[] projects = DLTKCore
+ .create(ResourcesPlugin.getWorkspace()
+ .getRoot())
.getScriptProjects(TclNature.NATURE_ID);
ResourcesPlugin.getWorkspace().run(
new ProjectRefreshOperation(projects), monitor);
@@ -260,9 +260,10 @@
@Override
protected void validateValuePresenceFor(PreferenceKey key) {
if (key.belongsTo(TclPlugin.PLUGIN_ID)
- && (DLTKCore.LANGUAGE_FILENAME_ASSOCIATIONS.equals(key
- .getName()) || TclSourceElementParser2.class
- .getName().equals(key.getName()))) {
+ && (DLTKCore.LANGUAGE_FILENAME_ASSOCIATIONS
+ .equals(key.getName())
+ || TclSourceElementParser2.class.getName()
+ .equals(key.getName()))) {
return;
}
super.validateValuePresenceFor(key);
@@ -289,29 +290,27 @@
protected Control createOptionsBlock(Composite parent) {
Composite block = SWTFactory.createComposite(parent,
parent.getFont(), 1, 1, GridData.FILL_BOTH);
- SWTFactory
- .createLabel(
- block,
- TclPreferencesMessages.TclCorePreferencePage_checkContentWithoutExtension,
- 1);
+ SWTFactory.createLabel(block,
+ TclPreferencesMessages.TclCorePreferencePage_checkContentWithoutExtension,
+ 1);
createCheckbox(block,
- TclPreferencesMessages.TclCorePreferencePage_local, KEYS[0]);
+ TclPreferencesMessages.TclCorePreferencePage_local,
+ KEYS[0]);
createCheckbox(block,
TclPreferencesMessages.TclCorePreferencePage_remote,
KEYS[1]);
- SWTFactory
- .createLabel(
- block,
- TclPreferencesMessages.TclCorePreferencePage_checkContentAnyExtension,
- 1);
+ SWTFactory.createLabel(block,
+ TclPreferencesMessages.TclCorePreferencePage_checkContentAnyExtension,
+ 1);
createCheckbox(block,
- TclPreferencesMessages.TclCorePreferencePage_local, KEYS[2]);
+ TclPreferencesMessages.TclCorePreferencePage_local,
+ KEYS[2]);
createCheckbox(block,
TclPreferencesMessages.TclCorePreferencePage_remote,
KEYS[3]);
- final Composite patternComposite = SWTFactory.createComposite(
- block, block.getFont(), 1, 1, GridData.FILL_BOTH);
+ final Composite patternComposite = SWTFactory.createComposite(block,
+ block.getFont(), 1, 1, GridData.FILL_BOTH);
final GridLayout patternLayout = new GridLayout();
patternLayout.numColumns = 2;
patternLayout.marginHeight = 0;
@@ -323,11 +322,9 @@
TclPreferencesMessages.TclCorePreferencePage_checkContentEditExclude,
TclPreferencesMessages.TclCorePreferencePage_checkContentRemoveExclude };
{
- SWTFactory
- .createLabel(
- patternComposite,
- TclPreferencesMessages.TclCorePreferencePage_Associations,
- 2);
+ SWTFactory.createLabel(patternComposite,
+ TclPreferencesMessages.TclCorePreferencePage_Associations,
+ 2);
final Set<String> associations = DLTKLanguageManager
.loadFilenameAssociations(TclNature.NATURE_ID);
includeAdapter.setContributedElements(associations);
@@ -354,8 +351,8 @@
includeDialog.setDialogFieldListener(includeAdapter);
includeDialog.setRemoveButtonIndex(IDX_REMOVE);
- includeDialog.setViewerComparator(new AssociationViwerSorter(
- associations));
+ includeDialog.setViewerComparator(
+ new AssociationViwerSorter(associations));
final Control listControl = includeDialog
.getListControl(patternComposite);
final GridData listControlLayoutData = new GridData(
@@ -368,11 +365,9 @@
| GridData.VERTICAL_ALIGN_BEGINNING));
}
{
- SWTFactory
- .createLabel(
- patternComposite,
- TclPreferencesMessages.TclCorePreferencePage_checkContentExcludes,
- 2);
+ SWTFactory.createLabel(patternComposite,
+ TclPreferencesMessages.TclCorePreferencePage_checkContentExcludes,
+ 2);
excludeDialog = new ListDialogField(excludeAdapter, buttons,
new LabelProvider());
excludeDialog.setDialogFieldListener(excludeAdapter);
@@ -402,10 +397,12 @@
container);
}
+ @Override
protected String getHelpId() {
return null;
}
+ @Override
protected String getProjectHelpId() {
return null;
}
@@ -415,18 +412,22 @@
return TclNature.NATURE_ID;
}
+ @Override
protected void setDescription() {
// empty
}
+ @Override
protected void setPreferenceStore() {
// empty
}
+ @Override
protected String getPreferencePageId() {
return null;
}
+ @Override
protected String getPropertyPageId() {
return null;
}
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/CodeTemplateTclSourceViewerConfiguration.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/CodeTemplateTclSourceViewerConfiguration.java
index 1464465..a404fb6 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/CodeTemplateTclSourceViewerConfiguration.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/CodeTemplateTclSourceViewerConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -12,7 +12,6 @@
import org.eclipse.dltk.tcl.internal.ui.TclUI;
import org.eclipse.dltk.tcl.ui.text.TclPartitions;
-import org.eclipse.dltk.ui.DLTKUIPlugin;
import org.eclipse.dltk.ui.PreferenceConstants;
import org.eclipse.dltk.ui.text.IColorManager;
import org.eclipse.dltk.ui.text.ScriptTextTools;
@@ -34,8 +33,8 @@
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.texteditor.ITextEditor;
-public class CodeTemplateTclSourceViewerConfiguration extends
- SimpleTclSourceViewerConfiguration {
+public class CodeTemplateTclSourceViewerConfiguration
+ extends SimpleTclSourceViewerConfiguration {
private final TemplateVariableProcessor fProcessor;
@@ -47,9 +46,7 @@
fProcessor = processor;
}
- /*
- * @see SourceViewerConfiguration#getContentAssistant(ISourceViewer)
- */
+ @Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
IPreferenceStore store = TclUI.getDefault().getPreferenceStore();
@@ -66,22 +63,22 @@
assistant.setContentAssistProcessor(fProcessor,
TclPartitions.TCL_COMMENT);
- assistant.enableAutoInsert(store
- .getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT));
+ assistant.enableAutoInsert(
+ store.getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT));
assistant.enableAutoActivation(store
.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION));
assistant.setAutoActivationDelay(store
.getInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
- assistant
- .setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
- assistant
- .setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
+ assistant.setProposalPopupOrientation(
+ IContentAssistant.PROPOSAL_OVERLAY);
+ assistant.setContextInformationPopupOrientation(
+ IContentAssistant.CONTEXT_INFO_ABOVE);
assistant
.setInformationControlCreator(new IInformationControlCreator() {
public IInformationControl createInformationControl(
Shell parent) {
- return new DefaultInformationControl(parent, EditorsUI
- .getTooltipAffordanceString());
+ return new DefaultInformationControl(parent,
+ EditorsUI.getTooltipAffordanceString());
}
});
@@ -106,9 +103,10 @@
/*
* @see SourceViewerConfiguration#getTextHover(ISourceViewer, String, int)
- *
+ *
* @since 2.1
*/
+ @Override
public ITextHover getTextHover(ISourceViewer sourceViewer,
String contentType, int stateMask) {
return new TemplateVariableTextHover(fProcessor);
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/SourcesSelectionDialog.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/SourcesSelectionDialog.java
index 43c7671..997e2a3 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/SourcesSelectionDialog.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/SourcesSelectionDialog.java
@@ -17,8 +17,8 @@
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -38,9 +38,10 @@
}
}
- private final class SourcesContentProvider implements
- IStructuredContentProvider {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ private final class SourcesContentProvider
+ implements IStructuredContentProvider {
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
}
public void dispose() {
@@ -54,16 +55,13 @@
private ListViewer sourcesViewer;
private Set<String> sources = new HashSet<String>();
private IEnvironmentUI environmentUI;
- private IEnvironment environment;
private Button remove;
private Button add;
protected SourcesSelectionDialog(IShellProvider parentShell,
IEnvironment environment) {
super(parentShell);
- this.environment = environment;
- this.environmentUI = (IEnvironmentUI) environment
- .getAdapter(IEnvironmentUI.class);
+ this.environmentUI = environment.getAdapter(IEnvironmentUI.class);
}
@Override
@@ -80,34 +78,33 @@
sourcesViewer.setLabelProvider(new SourcesLabelProvider());
sourcesViewer.setContentProvider(new SourcesContentProvider());
sourcesViewer.setInput(sources);
- sourcesViewer.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
+ sourcesViewer.getControl()
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
Composite buttons = new Composite(contents, SWT.NONE);
buttons.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, true));
buttons.setLayout(new GridLayout(1, false));
add = new Button(buttons, SWT.PUSH);
add.setText("Add");
- add.addSelectionListener(new SelectionListener() {
+ add.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- String file = environmentUI.selectFile(sourcesViewer.getList()
- .getShell(), IEnvironmentUI.DEFAULT);
+ String file = environmentUI.selectFile(
+ sourcesViewer.getList().getShell(),
+ IEnvironmentUI.DEFAULT);
if (file != null) {
sources.add(file);
sourcesViewer.refresh();
}
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
});
add.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
remove = new Button(buttons, SWT.PUSH);
remove.setText("Remove");
remove.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
- remove.addSelectionListener(new SelectionListener() {
+ remove.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
String path = getSelection();
if (path != null) {
@@ -115,10 +112,6 @@
sourcesViewer.refresh();
}
}
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
});
updateEnablement();
sourcesViewer
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclPairMatcher.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclPairMatcher.java
index 45f779f..484d8d5 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclPairMatcher.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclPairMatcher.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.tcl.internal.ui.text;
@@ -56,7 +55,8 @@
* @param newTimestamp
* @param newHashcode
*/
- public ParserThread(String content, long newTimestamp, long newHashcode) {
+ public ParserThread(String content, long newTimestamp,
+ long newHashcode) {
super(ParserThread.class.getName());
this.content = content;
this.newTimestamp = newTimestamp;
@@ -77,8 +77,8 @@
parsedAt = startTime;
}
if (DEBUG) {
- System.out
- .println("ParserThread - END " + (System.currentTimeMillis() - startTime)); //$NON-NLS-1$
+ System.out.println("ParserThread - END " //$NON-NLS-1$
+ + (System.currentTimeMillis() - startTime));
}
} finally {
synchronized (lock) {
@@ -100,14 +100,12 @@
public PairBlock(int start, int end, char c) {
this.start = start;
this.end = end;
- this.c = c;
}
int start;
int end;
- char c;
};
private PairBlock[] cachedPairs;
@@ -126,8 +124,8 @@
*/
final ISourceParser pp = DLTKLanguageManager
.getSourceParser(TclNature.NATURE_ID);
- final ModuleDeclaration md = (ModuleDeclaration) pp.parse(
- new ModuleSource(contents), null);
+ final ModuleDeclaration md = (ModuleDeclaration) pp
+ .parse(new ModuleSource(contents), null);
if (md == null) {
return new PairBlock[0];
}
@@ -137,14 +135,14 @@
@Override
public boolean visitGeneral(ASTNode be) throws Exception {
if (be instanceof StringLiteral) {
- result.add(new PairBlock(be.sourceStart(), be
- .sourceEnd() - 1, '\"'));
+ result.add(new PairBlock(be.sourceStart(),
+ be.sourceEnd() - 1, '\"'));
} else if (be instanceof TclExecuteExpression) {
- result.add(new PairBlock(be.sourceStart(), be
- .sourceEnd() - 1, '['));
+ result.add(new PairBlock(be.sourceStart(),
+ be.sourceEnd() - 1, '['));
} else if (be instanceof TclAdvancedExecuteExpression) {
- result.add(new PairBlock(be.sourceStart() - 1, be
- .sourceEnd(), '['));
+ result.add(new PairBlock(be.sourceStart() - 1,
+ be.sourceEnd(), '['));
} else if (be instanceof Block) {
int start = be.sourceStart();
if (start != 0) {
@@ -176,7 +174,7 @@
/**
* Fully recalcs pairs for document
- *
+ *
* @param doc
* @throws BadLocationException
*/
@@ -234,7 +232,7 @@
/**
* Tests that either the symbol at <code>offset</code> or the previous one
* is a brace. This function checks that offsets are in the allowed range.
- *
+ *
* @param document
* @param offset
* @return
@@ -243,7 +241,8 @@
private static boolean isBraceAt(IDocument document, int offset)
throws BadLocationException {
// test symbol at offset
- if (offset < document.getLength() && isBrace(document.getChar(offset))) {
+ if (offset < document.getLength()
+ && isBrace(document.getChar(offset))) {
return true;
}
// test previous symbol
@@ -277,7 +276,7 @@
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.text.source.ICharacterPairMatcher#getAnchor()
*/
public int getAnchor() {
diff --git a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclQuickAssistLightBulbUpdater.java b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclQuickAssistLightBulbUpdater.java
index 3ed6401..0086797 100644
--- a/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclQuickAssistLightBulbUpdater.java
+++ b/tcl/plugins/org.eclipse.dltk.tcl.ui/src/org/eclipse/dltk/tcl/internal/ui/text/TclQuickAssistLightBulbUpdater.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -45,13 +45,10 @@
import org.eclipse.ui.texteditor.AnnotationPreference;
import org.eclipse.ui.texteditor.ITextEditor;
-/**
- *
- */
public class TclQuickAssistLightBulbUpdater {
- public static class AssistAnnotation extends Annotation implements
- IAnnotationPresentation {
+ public static class AssistAnnotation extends Annotation
+ implements IAnnotationPresentation {
// XXX: To be fully correct this should be a non-static fields in
// QuickAssistLightBulbUpdater
@@ -61,8 +58,8 @@
Annotation annotation = new Annotation(
"org.eclipse.dltk.ui.warning", false, null); //$NON-NLS-1$
AnnotationPreference preference = EditorsUI
- .getAnnotationPreferenceLookup().getAnnotationPreference(
- annotation);
+ .getAnnotationPreferenceLookup()
+ .getAnnotationPreference(annotation);
if (preference != null)
LAYER = preference.getPresentationLayer() - 1;
else
@@ -75,9 +72,6 @@
public AssistAnnotation() {
}
- /*
- * @see org.eclipse.jface.text.source.IAnnotationPresentation#getLayer()
- */
public int getLayer() {
return LAYER;
}
@@ -90,11 +84,6 @@
return fImage;
}
- /*
- * (non-Javadoc)
- *
- * @see IAnnotationPresentation#paint(GC,Canvas,Rectangle)
- */
public void paint(GC gc, Canvas canvas, Rectangle r) {
ImageUtilities.drawImage(getImage(), gc, canvas, r, SWT.CENTER,
SWT.TOP);
@@ -105,14 +94,13 @@
private final Annotation fAnnotation;
private boolean fIsAnnotationShown;
private ITextEditor fEditor;
- private ITextViewer fViewer;
private ISelectionChangedListener fListener;
private IPropertyChangeListener fPropertyChangeListener;
- public TclQuickAssistLightBulbUpdater(ITextEditor part, ITextViewer viewer) {
+ public TclQuickAssistLightBulbUpdater(ITextEditor part,
+ ITextViewer viewer) {
fEditor = part;
- fViewer = viewer;
fAnnotation = new AssistAnnotation();
fIsAnnotationShown = false;
fPropertyChangeListener = null;
@@ -129,8 +117,8 @@
ISelection selection = event.getSelection();
if (selection instanceof ITextSelection) {
ITextSelection textSelection = (ITextSelection) selection;
- doSelectionChanged(textSelection.getOffset(), textSelection
- .getLength());
+ doSelectionChanged(textSelection.getOffset(),
+ textSelection.getLength());
}
}
};
@@ -139,8 +127,8 @@
private void uninstallSelectionListener() {
if (fListener != null) {
- fEditor.getSelectionProvider().removeSelectionChangedListener(
- this.fListener);
+ fEditor.getSelectionProvider()
+ .removeSelectionChangedListener(this.fListener);
fListener = null;
}
IAnnotationModel model = getAnnotationModel();
@@ -159,8 +147,8 @@
doPropertyChanged(event.getProperty());
}
};
- TclUI.getDefault().getPreferenceStore().addPropertyChangeListener(
- fPropertyChangeListener);
+ TclUI.getDefault().getPreferenceStore()
+ .addPropertyChangeListener(fPropertyChangeListener);
}
}
@@ -194,8 +182,8 @@
}
private ISourceModule getSourceModule() {
- IModelElement elem = DLTKUIPlugin.getEditorInputModelElement(fEditor
- .getEditorInput());
+ IModelElement elem = DLTKUIPlugin
+ .getEditorInputModelElement(fEditor.getEditorInput());
if (elem instanceof ISourceModule) {
return (ISourceModule) elem;
}
@@ -203,13 +191,13 @@
}
private IAnnotationModel getAnnotationModel() {
- return DLTKUIPlugin.getDocumentProvider().getAnnotationModel(
- fEditor.getEditorInput());
+ return DLTKUIPlugin.getDocumentProvider()
+ .getAnnotationModel(fEditor.getEditorInput());
}
private IDocument getDocument() {
- return DLTKUIPlugin.getDocumentProvider().getDocument(
- fEditor.getEditorInput());
+ return DLTKUIPlugin.getDocumentProvider()
+ .getDocument(fEditor.getEditorInput());
}
private void doSelectionChanged(int offset, int length) {
@@ -274,9 +262,9 @@
// this iterator is not protected, it may throw
// ConcurrentModificationExceptions
- Iterator iter = model.getAnnotationIterator();
+ Iterator<Annotation> iter = model.getAnnotationIterator();
while (iter.hasNext()) {
- Annotation annot = (Annotation) iter.next();
+ Annotation annot = iter.next();
if (ScriptAnnotationUtils.isQuickFixableType(annot)) {
// may throw an IndexOutOfBoundsException upon concurrent
// annotation model changes
@@ -284,8 +272,8 @@
if (pos != null) {
// may throw an IndexOutOfBoundsException upon
// concurrent document modification
- int startLine = document.getLineOfOffset(pos
- .getOffset());
+ int startLine = document
+ .getLineOfOffset(pos.getOffset());
if (startLine == currLine && hasCorrections(annot)) {
return true;
}