Cleanup.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/protoc/ProtoDescriptorPathFinder.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/protoc/ProtoDescriptorPathFinder.java
index ff6e925..00805cf 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/protoc/ProtoDescriptorPathFinder.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/protoc/ProtoDescriptorPathFinder.java
@@ -18,8 +18,7 @@
/**
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-class ProtoDescriptorPathFinder {
+@Singleton class ProtoDescriptorPathFinder {
private final String descriptorFqn;
@@ -27,8 +26,7 @@
this(separator);
}
- @VisibleForTesting
- ProtoDescriptorPathFinder(String fileSeparator) {
+ @VisibleForTesting ProtoDescriptorPathFinder(String fileSeparator) {
descriptorFqn = concat(fileSeparator, asList("", "google", "protobuf", "descriptor.proto"));
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/CommentNodesFinder.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/CommentNodesFinder.java
index 1c8271c..1c30176 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/CommentNodesFinder.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/commands/CommentNodesFinder.java
@@ -27,15 +27,14 @@
/**
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-class CommentNodesFinder {
+@Singleton class CommentNodesFinder {
private static final String MATCH_ANYTHING = ".*";
@Inject private INodes nodes;
@Inject private final IResourceScopeCache cache = IResourceScopeCache.NullImpl.INSTANCE;
- Pair<INode, Matcher> matchingCommentNode(EObject target, String...patternsToMatch) {
+ Pair<INode, Matcher> matchingCommentNode(EObject target, String... patternsToMatch) {
ICompositeNode node = getNode(target);
for (INode currentNode : node.getAsTreeIterable()) {
if (!nodes.isHiddenLeafNode(currentNode)) {
@@ -52,9 +51,7 @@
for (String line : comment) {
for (Pattern pattern : compile(patternsToMatch, target)) {
Matcher matcher = pattern.matcher(line);
- if (matcher.matches()) {
- return pair(currentNode, matcher);
- }
+ if (matcher.matches()) { return pair(currentNode, matcher); }
}
}
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java
index ff49697..3b24ca8 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/MLCommentDocumentationProvider.java
@@ -22,15 +22,16 @@
import com.google.inject.*;
/**
- * Provides multiple-line comments of a protobuf element as its documentation when hovered.
+ * Provides multiple-line comments of a protobuf element as its documentation
+ * when hovered.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class MLCommentDocumentationProvider implements IEObjectDocumentationProvider {
+@Singleton public class MLCommentDocumentationProvider implements IEObjectDocumentationProvider {
private static final Pattern COMMENT = compile("(?s)/\\*\\*?.*");
- private static final Patterns CLEAN_UP = compileAll("\\A/\\*\\*?", "\\*/\\z", "(?m)^( |\\t)*\\** ?", "(?m)( |\\t)*\\**( |\\t)*$");
+ private static final Patterns CLEAN_UP = compileAll("\\A/\\*\\*?", "\\*/\\z", "(?m)^( |\\t)*\\** ?",
+ "(?m)( |\\t)*\\**( |\\t)*$");
@Inject private INodes nodes;
@@ -42,21 +43,19 @@
private String findComment(EObject o) {
String returnValue = null;
ICompositeNode node = getNode(o);
- if (node == null) {
- return null;
- }
+ if (node == null) { return null; }
// get the last multiple-line comment before a non hidden leaf node
for (INode currentNode : node.getAsTreeIterable()) {
- if (!nodes.isHiddenLeafNode(currentNode)) {
- continue;
- }
- if (!nodes.belongsToMultipleLineComment(currentNode)) {
- continue;
- }
- String text = ((ILeafNode) currentNode).getText();
- if (COMMENT.matcher(text).matches()) {
- returnValue = cleanUp(text);
- }
+ if (!nodes.isHiddenLeafNode(currentNode)) {
+ continue;
+ }
+ if (!nodes.belongsToMultipleLineComment(currentNode)) {
+ continue;
+ }
+ String text = ((ILeafNode) currentNode).getText();
+ if (COMMENT.matcher(text).matches()) {
+ returnValue = cleanUp(text);
+ }
}
return returnValue;
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/ProtobufDocumentationProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/ProtobufDocumentationProvider.java
index 2ea544c..ef6eda8 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/ProtobufDocumentationProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/ProtobufDocumentationProvider.java
@@ -18,24 +18,23 @@
import com.google.inject.*;
/**
- * Provides single-line and multi-line comments as documentation of a protobuf element.
+ * Provides single-line and multi-line comments as documentation of a protobuf
+ * element.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class ProtobufDocumentationProvider implements IEObjectDocumentationProvider {
+@Singleton public class ProtobufDocumentationProvider implements IEObjectDocumentationProvider {
private final List<IEObjectDocumentationProvider> delegates = new ArrayList<IEObjectDocumentationProvider>();
- @Inject
- public ProtobufDocumentationProvider(SLCommentDocumentationProvider p1, MLCommentDocumentationProvider p2) {
+ @Inject public ProtobufDocumentationProvider(SLCommentDocumentationProvider p1, MLCommentDocumentationProvider p2) {
delegates.add(p1);
delegates.add(p2);
}
/** {@inheritDoc} */
@Override public String getDocumentation(EObject o) {
- for (IEObjectDocumentationProvider p: delegates) {
+ for (IEObjectDocumentationProvider p : delegates) {
String documentation = p.getDocumentation(o);
if (!(isEmpty(documentation))) {
return documentation;
@@ -43,5 +42,4 @@
}
return "";
}
-
}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java
index 94b939c..243746d 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/documentation/SLCommentDocumentationProvider.java
@@ -24,14 +24,14 @@
import com.google.inject.*;
/**
- * Provides single-line comments of a protobuf element as its documentation when hovered.
+ * Provides single-line comments of a protobuf element as its documentation when
+ * hovered.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class SLCommentDocumentationProvider implements IEObjectDocumentationProvider {
+@Singleton public class SLCommentDocumentationProvider implements IEObjectDocumentationProvider {
- private static final Pattern COMMENT_START = compile("//\\s*"); // "//" plus any whitespace
+ private static final Pattern COMMENT_START = compile("//\\s*"); // "//" plus whitespace
private static final Patterns NEW_LINE = compileAll("\\r\\n", "\\n");
@Inject private FieldOptions fieldOptions;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java
index 56eaa3c..1b27863 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/FileOpener.java
@@ -24,8 +24,7 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class FileOpener {
+@Singleton public class FileOpener {
@Inject private Resources resources;
@@ -38,7 +37,7 @@
public IEditorPart openProtoFileInFileSystem(URI uri) throws PartInitException {
IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(uri.toFileString()));
IEditorInput editorInput = new FileStoreEditorInput(fileStore);
- return openFile(editorInput/*"org.eclipse.ui.DefaultTextEditor"*/);
+ return openFile(editorInput/* "org.eclipse.ui.DefaultTextEditor" */);
}
public IEditorPart openProtoFileInPlugin(URI uri) throws PartInitException {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ContentReader.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ContentReader.java
index 4f4358c..3fe4b89 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ContentReader.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ContentReader.java
@@ -18,8 +18,7 @@
/**
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-class ContentReader {
+@Singleton class ContentReader {
private static final int DEFAULT_FILE_SIZE = 15 * 1024;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/SaveActions.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/SaveActions.java
index 9e27081..1305350 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/SaveActions.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/SaveActions.java
@@ -22,8 +22,7 @@
/**
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-class SaveActions {
+@Singleton class SaveActions {
private static Logger logger = Logger.getLogger(SaveActions.class);
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/UriEditorInputs.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/UriEditorInputs.java
index 905de36..82a2c70 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/UriEditorInputs.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/UriEditorInputs.java
@@ -20,8 +20,7 @@
/**
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-class UriEditorInputs {
+@Singleton class UriEditorInputs {
File fileFrom(IURIEditorInput input) {
URI uri = input.getURI();
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java
index 3cb9de1..00edca0 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Images.java
@@ -25,8 +25,7 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class Images {
+@Singleton public class Images {
private static final String GIF_EXTENSION = ".gif";
private static final String DEFAULT_IMAGE = "empty.gif";
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
index 4e0aacf..4f25dc1 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/labeling/Labels.java
@@ -119,12 +119,11 @@
private Object labelFor(MessageField field) {
StyledString text = new StyledString(nameResolver.nameOf(field));
String typeName = messageFields.typeNameOf(field);
- if (typeName == null)
- {
+ if (typeName == null) {
typeName = "<unresolved reference>"; // TODO move to
}
- // properties
- // file
+ // properties
+ // file
String indexAndType = String.format(" [%d] : %s", field.getIndex(), typeName);
text.append(indexAndType, DECORATIONS_STYLER);
return text;
@@ -160,12 +159,11 @@
}
if (field instanceof ExtensionOptionField) {
IndexedElement source = ((ExtensionOptionField) field).getTarget();
- b.append("(")
- .append(options.nameForOption(source))
- .append(")");
+ b.append("(").append(options.nameForOption(source)).append(")");
}
}
}
+
private Object labelFor(Rpc rpc) {
StyledString text = new StyledString(nameResolver.nameOf(rpc));
String types = String.format(" : %s > %s", messageName(rpc.getArgType()), messageName(rpc.getReturnType()));
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/PreferenceStoreAccess.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/PreferenceStoreAccess.java
index 1b7d06a..768e1f6 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/PreferenceStoreAccess.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/PreferenceStoreAccess.java
@@ -29,8 +29,7 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class PreferenceStoreAccess implements IPreferenceStoreAccess {
+@Singleton public class PreferenceStoreAccess implements IPreferenceStoreAccess {
private boolean initialized = false;
@@ -41,13 +40,13 @@
@Override public IPreferenceStore getContextPreferenceStore(Object context) {
lazyInitialize();
return new ChainedPreferenceStore(new IPreferenceStore[] { getWritablePreferenceStore(context),
- ProtobufActivator.getInstance().getPreferenceStore(), EditorsUI.getPreferenceStore()});
+ ProtobufActivator.getInstance().getPreferenceStore(), EditorsUI.getPreferenceStore() });
}
@Override public IPreferenceStore getPreferenceStore() {
lazyInitialize();
return new ChainedPreferenceStore(new IPreferenceStore[] { getWritablePreferenceStore(),
- ProtobufActivator.getInstance().getPreferenceStore(), EditorsUI.getPreferenceStore()});
+ ProtobufActivator.getInstance().getPreferenceStore(), EditorsUI.getPreferenceStore() });
}
protected String getQualifier() {
@@ -70,7 +69,8 @@
if (finalContext instanceof IProject) {
ProjectScope projectScope = new ProjectScope((IProject) finalContext);
ScopedPreferenceStore result = new ScopedPreferenceStore(projectScope, getQualifier());
- result.setSearchContexts(new IScopeContext[] { projectScope, InstanceScope.INSTANCE, ConfigurationScope.INSTANCE });
+ result
+ .setSearchContexts(new IScopeContext[] { projectScope, InstanceScope.INSTANCE, ConfigurationScope.INSTANCE });
return result;
}
return getWritablePreferenceStore();
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java
index 702b2d0..3469297 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/resource/XtextResourceFactory.java
@@ -32,18 +32,21 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class XtextResourceFactory {
+@Singleton public class XtextResourceFactory {
@Inject private IResourceSetProvider resourceSetProvider;
@Inject private Resources resources;
/**
* Creates a new <code>{@link XtextResource}</code>.
- * @param uri the URI of the file containing the EMF model.
- * @param contents the contents of the file.
+ *
+ * @param uri
+ * the URI of the file containing the EMF model.
+ * @param contents
+ * the contents of the file.
* @return the created {@code XtextResource}.
- * @throws IOException if something goes wrong.
+ * @throws IOException
+ * if something goes wrong.
*/
public XtextResource createResource(String uri, String contents) throws IOException {
return createResource(createURI(uri), contents);
@@ -51,10 +54,14 @@
/**
* Creates a new <code>{@link XtextResource}</code>.
- * @param uri the URI of the file containing the EMF model.
- * @param contents the contents of the file.
+ *
+ * @param uri
+ * the URI of the file containing the EMF model.
+ * @param contents
+ * the contents of the file.
* @return the created {@code XtextResource}.
- * @throws IOException if something goes wrong.
+ * @throws IOException
+ * if something goes wrong.
*/
public XtextResource createResource(URI uri, String contents) throws IOException {
ResourceSet resourceSet = resourceSetProvider.get(resources.activeProject());
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileResolverStrategies.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileResolverStrategies.java
index 458899d..15ed6e9 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileResolverStrategies.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/scoping/FileResolverStrategies.java
@@ -19,8 +19,7 @@
/**
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-class FileResolverStrategies {
+@Singleton class FileResolverStrategies {
private final Map<PathResolutionType, FileResolverStrategy> strategies =
new HashMap<PathResolutionType, FileResolverStrategy>();
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Literals.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Literals.java
index 68da120..876f417 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Literals.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Literals.java
@@ -21,12 +21,12 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class Literals {
+@Singleton public class Literals {
/**
- * Calculates the index value for the given literal. The calculated index value is the maximum of all the index values
- * of the given literal's siblings, plus one. The minimum index value is zero.
+ * Calculates the index value for the given literal. The calculated index
+ * value is the maximum of all the index values of the given literal's
+ * siblings, plus one. The minimum index value is zero.
* <p>
* For example, in the following message:
*
@@ -39,7 +39,9 @@
*
* The calculated index value for the literal {@code WORK} will be 2.
* </p>
- * @param l the given literal.
+ *
+ * @param l
+ * the given literal.
* @return the calculated index value.
*/
public long calculateIndexOf(Literal l) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java
index cb8ccc2..96a5e3e 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/Resources.java
@@ -23,8 +23,7 @@
* @author alruiz@google.com (Alex Ruiz)
*/
@SuppressWarnings("deprecation")
-@Singleton
-public class Resources {
+@Singleton public class Resources {
private static final IViewReference[] NO_VIEW_REFERENCES = new IViewReference[0];
@@ -32,9 +31,12 @@
/**
* Returns the project that contains the resource at the given URI.
- * @param resourceUri the given URI.
- * @return the project that contains the resource at the given URI, or {@code null} if the resource at the given URI
- * is not in a workspace.
+ *
+ * @param resourceUri
+ * the given URI.
+ * @return the project that contains the resource at the given URI, or
+ * {@code null} if the resource at the given URI is not in a
+ * workspace.
*/
public IProject project(URI resourceUri) {
IFile file = file(resourceUri);
@@ -75,8 +77,11 @@
/**
* Indicates whether the given URI belongs to an existing file.
- * @param fileUri the URI to check, as a {@code String}.
- * @return {@code true} if the given URI belongs to an existing file, {@code false} otherwise.
+ *
+ * @param fileUri
+ * the URI to check, as a {@code String}.
+ * @return {@code true} if the given URI belongs to an existing file,
+ * {@code false} otherwise.
*/
public boolean fileExists(URI fileUri) {
IFile file = file(fileUri);
@@ -85,9 +90,11 @@
/**
* Returns a handle to a workspace file identified by the given URI.
- * @param uri the given URI.
- * @return a handle to a workspace file identified by the given URI or {@code null} if the URI does not belong to a
- * workspace file.
+ *
+ * @param uri
+ * the given URI.
+ * @return a handle to a workspace file identified by the given URI or
+ * {@code null} if the URI does not belong to a workspace file.
*/
public IFile file(URI uri) {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -97,7 +104,9 @@
/**
* Returns the project owning the file displayed in the given editor.
- * @param editor the given editor.
+ *
+ * @param editor
+ * the given editor.
* @return the project owning the file displayed in the given editor.
*/
public IProject project(IEditorPart editor) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java
index 47903dc..95b939b 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/util/editor/Editors.java
@@ -30,18 +30,17 @@
import com.google.inject.Singleton;
/**
- * Utility methods related to editors. Adapted from CDT's {@code org.eclipse.cdt.internal.ui.util.EditorUtility}.
+ * Utility methods related to editors. Adapted from CDT's
+ * {@code org.eclipse.cdt.internal.ui.util.EditorUtility}.
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class Editors {
+@Singleton public class Editors {
private static Logger logger = Logger.getLogger(Editors.class);
- public IRegion[] calculateChangedLineRegions(final ITextFileBuffer buffer,
- final IDocument current, final IProgressMonitor monitor)
- throws CoreException {
+ public IRegion[] calculateChangedLineRegions(final ITextFileBuffer buffer, final IDocument current,
+ final IProgressMonitor monitor) throws CoreException {
final SimpleReference<IRegion[]> result = new SimpleReference<IRegion[]>();
final SimpleReference<IStatus> errorStatus = new SimpleReference<IStatus>(OK_STATUS);
try {
@@ -67,8 +66,9 @@
}
/*
- * Returns regions of all lines which differ comparing {@code old}s content with {@code current}s content.
- * Successive lines are merged into one region.
+ * Returns regions of all lines which differ comparing {@code old}s
+ * content with {@code current}s content. Successive lines are merged
+ * into one region.
*/
private IRegion[] getChangedLineRegions(IDocument old) {
RangeDifference[] differences = differencesWith(old);
@@ -82,7 +82,8 @@
try {
startLineRegion = current.getLineInformation(startLine);
if (startLine >= endLine) {
- // startLine > endLine indicates a deletion of one or more lines.
+ // startLine > endLine indicates a deletion of one or more
+ // lines.
// Deletions are ignored except at the end of the document.
if (startLine == endLine
|| startLineRegion.getOffset() + startLineRegion.getLength() == current.getLength()) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension.java
index f91ffed..8375894 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension.java
@@ -30,8 +30,7 @@
public static final String EDITOR_CHECK = "com.google.eclipse.protobuf.ui.editorMarker";
- @VisibleForTesting
- @Inject MarkerCreator markerCreator;
+ @VisibleForTesting @Inject MarkerCreator markerCreator;
@Override protected void createMarkers(IFile file, List<Issue> list, IProgressMonitor monitor) throws CoreException {
for (Issue issue : list) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java
index 34d2d80..a5599f7 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ValidationTrigger.java
@@ -9,6 +9,7 @@
package com.google.eclipse.protobuf.ui.validation;
import static com.google.eclipse.protobuf.ui.validation.Validation.validate;
+import static com.google.eclipse.protobuf.util.Objects.areEqual;
import java.net.URI;
@@ -23,16 +24,18 @@
*
* @author alruiz@google.com (Alex Ruiz)
*/
-@Singleton
-public class ValidationTrigger {
+@Singleton public class ValidationTrigger {
private final String PROTO_EDITOR_ID = "com.google.eclipse.protobuf.Protobuf";
@Inject private Resources resources;
/**
- * Triggers validation of all open .proto files belonging to the given project.
- * @param project the given project.
+ * Triggers validation of all open .proto files belonging to the given
+ * project.
+ *
+ * @param project
+ * the given project.
*/
public void validateOpenEditors(IProject project) {
for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
@@ -64,11 +67,4 @@
URI uri2 = p2.getLocationURI();
return areEqual(uri1, uri2);
}
-
- private boolean areEqual(URI uri1, URI uri2) {
- if (uri1 == null) {
- return false;
- }
- return uri1.equals(uri2);
- }
}