Developement in master branch is tied to Eclipse 3.8 and Xtext 2.3.
diff --git a/com.google.eclipse.protobuf.feature/feature.xml b/com.google.eclipse.protobuf.feature/feature.xml
index 9d13594..b9ca702 100644
--- a/com.google.eclipse.protobuf.feature/feature.xml
+++ b/com.google.eclipse.protobuf.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="com.google.eclipse.protobuf"
label="%featureName"
- version="1.2.5.qualifier"
+ version="1.3.1.qualifier"
provider-name="%providerName">
<description url="https://code.google.com/p/protobuf-dt/">
@@ -22,7 +22,6 @@
</url>
<requires>
- <import plugin="org.eclipse.xtext" version="2.2.1" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.util"/>
<import plugin="org.eclipse.emf.ecore"/>
<import plugin="org.eclipse.emf.common"/>
@@ -30,7 +29,6 @@
<import plugin="org.eclipse.core.runtime" version="3.7.0" match="greaterOrEqual"/>
<import plugin="org.apache.log4j"/>
<import plugin="org.apache.commons.logging"/>
- <import plugin="org.eclipse.xtext.ui"/>
<import plugin="org.eclipse.ui.editors" version="3.7.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide" version="3.7.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.xtext.ui.shared"/>
@@ -43,6 +41,8 @@
<import plugin="org.eclipse.compare.core" version="3.5.200" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.console" version="3.5.100" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.workbench.texteditor"/>
+ <import plugin="org.eclipse.xtext" version="2.3.0" match="greaterOrEqual"/>
+ <import plugin="org.eclipse.xtext.ui" version="2.3.0" match="greaterOrEqual"/>
</requires>
<plugin
diff --git a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/stubs/resources/FileStub.java b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/stubs/resources/FileStub.java
index d1c59ee..b118d40 100644
--- a/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/stubs/resources/FileStub.java
+++ b/com.google.eclipse.protobuf.test/src/com/google/eclipse/protobuf/junit/stubs/resources/FileStub.java
@@ -543,4 +543,9 @@
}
markers.add(marker);
}
+
+ /** {@inheritDoc} */
+ @Override public void accept(IResourceProxyVisitor visitor, int depth, int memberFlags) throws CoreException {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/hyperlinking/ImportHyperlinking_Test.java b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/hyperlinking/ImportHyperlinking_Test.java
index 61636dd..ad7e51c 100644
--- a/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/hyperlinking/ImportHyperlinking_Test.java
+++ b/com.google.eclipse.protobuf.ui.functional.test/src/com/google/eclipse/protobuf/ui/editor/hyperlinking/ImportHyperlinking_Test.java
@@ -13,7 +13,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.junit.*;
-import org.junit.rules.TemporaryFolder;
import com.google.eclipse.protobuf.ui.junit.CommentReaderRule;
import com.google.eclipse.protobuf.ui.swtbot.ProtobufBot;
@@ -33,7 +32,6 @@
}
@Rule public CommentReaderRule commentReader = new CommentReaderRule();
- @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder();
// import 'google/protobuf/descriptor.proto';
@Test public void should_open_file_in_plugIn() throws InterruptedException {
@@ -45,6 +43,8 @@
private void navigateToImportedFile(SWTBotEclipseEditor editor) {
editor.navigateTo(0, 10);
+ // for "F3" to work on Mac OS, go to "System Preferences" > "Keyboard" and ensure
+ // "Use all F1, F2, etc keys as standard function keys" is checked
editor.pressShortcut(F3);
}
}
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory_createErrorIfNecessary_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory_createErrorIfNecessary_Test.java
index 4f52d6a..c3fe98e 100644
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory_createErrorIfNecessary_Test.java
+++ b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory_createErrorIfNecessary_Test.java
@@ -9,7 +9,7 @@
package com.google.eclipse.protobuf.ui.protoc.output;
import static com.google.eclipse.protobuf.junit.stubs.resources.MarkerStub.error;
-import static com.google.eclipse.protobuf.ui.validation.ProtobufResourceUIValidatorExtension.EDITOR_CHECK;
+import static com.google.eclipse.protobuf.ui.validation.MarkerTypes.EDITOR_CHECK;
import static org.hamcrest.core.IsEqual.equalTo;
import static org.junit.Assert.assertThat;
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension_createMarkers_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension_createMarkers_Test.java
deleted file mode 100644
index dc74956..0000000
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension_createMarkers_Test.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.validation;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static com.google.eclipse.protobuf.ui.validation.ProtobufResourceUIValidatorExtension.EDITOR_CHECK;
-import static org.mockito.Mockito.*;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.xtext.ui.editor.validation.MarkerCreator;
-import org.eclipse.xtext.validation.Issue;
-import org.junit.*;
-
-/**
- * Tests for <code>{@link ProtobufResourceUIValidatorExtension#createMarkers(IFile, List, IProgressMonitor)}</code>
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ProtobufResourceUIValidatorExtension_createMarkers_Test {
- private static IFile file;
- private static List<Issue> issues;
- private static IProgressMonitor monitor;
-
- @BeforeClass public static void setUpOnce() {
- file = mock(IFile.class);
- issues = newArrayList(mock(Issue.class), mock(Issue.class));
- monitor = mock(IProgressMonitor.class);
- }
-
- private MarkerCreator markerCreator;
- private ProtobufResourceUIValidatorExtension validator;
-
- @Before public void setUp() {
- markerCreator = mock(MarkerCreator.class);
- validator = new ProtobufResourceUIValidatorExtension();
- validator.markerCreator = markerCreator;
- }
-
- @Test public void should_create_markers_using_proto_editor_marker_type() throws CoreException {
- validator.createMarkers(file, issues, monitor);
- for (Issue issue : issues) {
- verify(markerCreator).createMarker(issue, file, EDITOR_CHECK);
- }
- }
-}
diff --git a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension_deleteMarkers_Test.java b/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension_deleteMarkers_Test.java
deleted file mode 100644
index 67faf47..0000000
--- a/com.google.eclipse.protobuf.ui.test/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension_deleteMarkers_Test.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.validation;
-
-import static com.google.eclipse.protobuf.ui.validation.ProtobufResourceUIValidatorExtension.EDITOR_CHECK;
-import static org.eclipse.core.resources.IResource.DEPTH_ZERO;
-import static org.eclipse.xtext.ui.MarkerTypes.*;
-import static org.mockito.Mockito.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.xtext.validation.CheckMode;
-import org.junit.*;
-
-/**
- * Tests for <code>{@link ProtobufResourceUIValidatorExtension#deleteMarkers(IFile, CheckMode, IProgressMonitor)}</code>.
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ProtobufResourceUIValidatorExtension_deleteMarkers_Test {
- private static CheckMode checkMode;
- private static IProgressMonitor monitor;
-
- @BeforeClass public static void setUpOnce() {
- checkMode = mock(CheckMode.class);
- monitor = mock(IProgressMonitor.class);
- }
-
- private IFile file;
- private ProtobufResourceUIValidatorExtension validator;
-
- @Before public void setUp() {
- file = mock(IFile.class);
- validator = new ProtobufResourceUIValidatorExtension();
- }
-
- @Test public void should_delete_all_xtext_and_protocol_buffer_editor_markers() throws CoreException {
- validator.deleteMarkers(file, checkMode, monitor);
- verifyDeletionOfMarkers(FAST_VALIDATION, NORMAL_VALIDATION, EDITOR_CHECK);
- }
-
- private void verifyDeletionOfMarkers(String...markerTypes) throws CoreException {
- for (String markerType : markerTypes) {
- verify(file).deleteMarkers(markerType, true, DEPTH_ZERO);
- }
- }
-}
diff --git a/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
index 646b74f..fd56229 100644
--- a/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
+++ b/com.google.eclipse.protobuf.ui/META-INF/MANIFEST.MF
@@ -2,11 +2,11 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.2.5.qualifier
+Bundle-Version: 1.3.1.qualifier
Bundle-SymbolicName: com.google.eclipse.protobuf.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: com.google.eclipse.protobuf;visibility:=reexport,
- org.eclipse.xtext.ui,
+ org.eclipse.xtext.ui;bundle-version="2.3.0",
org.eclipse.ui.editors;bundle-version="3.7.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.xtext.ui.shared,
@@ -17,9 +17,9 @@
com.ibm.icu,
org.eclipse.emf.databinding,
org.eclipse.core.resources,
- org.eclipse.core.filesystem;bundle-version="1.3.100",
- org.eclipse.compare.core;bundle-version="3.5.200",
- org.eclipse.ui.console;bundle-version="3.5.100"
+ org.eclipse.core.filesystem,
+ org.eclipse.compare.core,
+ org.eclipse.ui.console
Import-Package: org.apache.commons.logging,
org.apache.log4j,
org.eclipse.ui.texteditor.spelling
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java
index 003ef12..98b870a 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/ProtobufUiModule.java
@@ -13,7 +13,6 @@
import static org.eclipse.ui.PlatformUI.isWorkbenchRunning;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.reconciler.IReconciler;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -25,9 +24,8 @@
import org.eclipse.xtext.ui.editor.model.XtextDocumentProvider;
import org.eclipse.xtext.ui.editor.outline.actions.IOutlineContribution;
import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreInitializer;
-import org.eclipse.xtext.ui.editor.quickfix.XtextQuickAssistProcessor;
import org.eclipse.xtext.ui.editor.syntaxcoloring.*;
-import org.eclipse.xtext.ui.validation.IResourceUIValidatorExtension;
+import org.eclipse.xtext.ui.validation.MarkerTypeProvider;
import com.google.eclipse.protobuf.resource.IResourceVerifier;
import com.google.eclipse.protobuf.scoping.IFileUriResolver;
@@ -36,7 +34,6 @@
import com.google.eclipse.protobuf.ui.editor.*;
import com.google.eclipse.protobuf.ui.editor.hyperlinking.ProtobufHyperlinkDetector;
import com.google.eclipse.protobuf.ui.editor.model.ProtobufDocumentProvider;
-import com.google.eclipse.protobuf.ui.editor.spelling.ProtobufReconciler;
import com.google.eclipse.protobuf.ui.editor.syntaxcoloring.*;
import com.google.eclipse.protobuf.ui.internal.ProtobufActivator;
import com.google.eclipse.protobuf.ui.outline.*;
@@ -48,7 +45,6 @@
import com.google.eclipse.protobuf.ui.preferences.general.GeneralPreferences;
import com.google.eclipse.protobuf.ui.preferences.misc.MiscellaneousPreferences;
import com.google.eclipse.protobuf.ui.preferences.paths.PathsPreferences;
-import com.google.eclipse.protobuf.ui.quickfix.ProtobufQuickAssistProcessor;
import com.google.eclipse.protobuf.ui.resource.*;
import com.google.eclipse.protobuf.ui.scoping.FileUriResolver;
import com.google.eclipse.protobuf.ui.validation.*;
@@ -89,10 +85,6 @@
return PreferenceDrivenProtobufParser.class;
}
- @Override public Class<? extends IReconciler> bindIReconciler() {
- return ProtobufReconciler.class;
- }
-
public Class<? extends IResourceServiceProvider> bindIResourceServiceProvider() {
return ProtobufServiceProvider.class;
}
@@ -101,10 +93,6 @@
return ResourceVerifier.class;
}
- public Class<? extends IResourceUIValidatorExtension> bindIResourceUIValidatorExtension() {
- return ProtobufResourceUIValidatorExtension.class;
- }
-
public Class<? extends ISemanticHighlightingCalculator> bindISemanticHighlightingCalculator() {
return ProtobufSemanticHighlightingCalculator.class;
}
@@ -113,12 +101,12 @@
return AutoAddNatureEditorCallback.class;
}
- public Class<? extends XtextDocumentProvider> bindXtextDocumentProvider() {
- return ProtobufDocumentProvider.class;
+ @Override public Class<? extends MarkerTypeProvider> bindMarkerTypeProvider() {
+ return ProtobufMarkerTypeProvider.class;
}
- public Class<? extends XtextQuickAssistProcessor> bindXtextQuickAssistProcessor(){
- return ProtobufQuickAssistProcessor.class;
+ public Class<? extends XtextDocumentProvider> bindXtextDocumentProvider() {
+ return ProtobufDocumentProvider.class;
}
public void configureFileOutsideWorkspaceIconUpdater(Binder binder) {
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufReconcileStrategy.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufReconcileStrategy.java
deleted file mode 100644
index 949f840..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufReconcileStrategy.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.editor.spelling;
-
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.reconciler.DirtyRegion;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.ui.texteditor.spelling.SpellingService;
-import org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy;
-
-import com.google.eclipse.protobuf.model.util.INodes;
-import com.google.inject.Inject;
-
-/**
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ProtobufReconcileStrategy extends XtextDocumentReconcileStrategy {
- private ProtobufSpelling spellingStrategy;
-
- @Inject private INodes nodes;
-
- @Override public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
- super.reconcile(dirtyRegion, subRegion);
- if (spellingStrategy == null) {
- return;
- }
- spellingStrategy.reconcile(dirtyRegion, subRegion);
- }
-
- @Override public void reconcile(IRegion subRegion) {
- super.reconcile(subRegion);
- initialReconcile();
- }
-
- @Override public void setDocument(IDocument document) {
- super.setDocument(document);
- if (spellingStrategy == null) {
- return;
- }
- spellingStrategy.setDocument(document);
- initialReconcile();
- }
-
- private void initialReconcile() {
- if (spellingStrategy == null) {
- return;
- }
- spellingStrategy.initialReconcile();
- }
-
- void addSpellSupport(ISourceViewer viewer, SpellingService spellingService) {
- if (spellingStrategy != null) {
- return;
- }
- spellingStrategy = new ProtobufSpelling(viewer, spellingService, nodes);
- }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufReconciler.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufReconciler.java
deleted file mode 100644
index 0b4a145..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufReconciler.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.editor.spelling;
-
-import static org.eclipse.ui.editors.text.EditorsUI.getSpellingService;
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.xtext.ui.editor.reconciler.XtextReconciler;
-
-import com.google.inject.Inject;
-
-/**
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ProtobufReconciler extends XtextReconciler {
- private boolean installed;
-
- @Inject public ProtobufReconciler(ProtobufReconcileStrategy strategy) {
- super(strategy);
- }
-
- @Override public void install(ITextViewer textViewer) {
- if (installed) {
- return;
- }
- super.install(textViewer);
- if (textViewer instanceof ISourceViewer) {
- ISourceViewer viewer = (ISourceViewer) textViewer;
- ProtobufReconcileStrategy strategy = (ProtobufReconcileStrategy) getReconcilingStrategy("");
- strategy.addSpellSupport(viewer, getSpellingService());
- }
- installed = true;
- }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufSpelling.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufSpelling.java
deleted file mode 100644
index 14bdda8..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/spelling/ProtobufSpelling.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.editor.spelling;
-
-import static org.eclipse.xtext.nodemodel.util.NodeModelUtils.*;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.*;
-import org.eclipse.jface.text.source.*;
-import org.eclipse.ui.texteditor.spelling.*;
-import org.eclipse.xtext.nodemodel.*;
-import org.eclipse.xtext.parser.IParseResult;
-import org.eclipse.xtext.resource.XtextResource;
-import org.eclipse.xtext.ui.editor.model.XtextDocument;
-import org.eclipse.xtext.util.concurrent.IUnitOfWork;
-
-import com.google.eclipse.protobuf.model.util.INodes;
-import com.google.eclipse.protobuf.protobuf.Import;
-
-/**
- * @author alruiz@google.com (Alex Ruiz)
- */
-class ProtobufSpelling extends SpellingReconcileStrategy {
- private final INodes nodes;
-
- ProtobufSpelling(ISourceViewer viewer, SpellingService spellingService, INodes nodes) {
- super(viewer, spellingService);
- this.nodes = nodes;
- }
-
- @Override public void setDocument(IDocument document) {
- super.setDocument(document);
- }
-
- @Override public void reconcile(IRegion region) {
- IAnnotationModel model = getAnnotationModel();
- if (model == null) {
- return;
- }
- super.reconcile(new Region(0, xtextDocument().getLength()));
- removeUnwantedAnnotations(model);
- }
-
- private void removeUnwantedAnnotations(final IAnnotationModel model) {
- xtextDocument().readOnly(new IUnitOfWork.Void<XtextResource>() {
- @Override public void process(XtextResource resource) throws Exception {
- IParseResult parseResult = resource.getParseResult();
- if (parseResult != null) {
- removeUnwantedAnnotations(parseResult.getRootNode(), model);
- }
- }
- });
- }
-
- private XtextDocument xtextDocument() {
- return (XtextDocument) super.getDocument();
- }
-
- @SuppressWarnings("unchecked")
- private void removeUnwantedAnnotations(INode rootNode, IAnnotationModel model) {
- Iterator<Annotation> iterator = model.getAnnotationIterator();
- while (iterator.hasNext()) {
- Annotation annotation = iterator.next();
- if (shouldRemoveFromModel(annotation, model, rootNode)) {
- model.removeAnnotation(annotation);
- }
- }
- }
-
- private boolean shouldRemoveFromModel(Annotation annotation, IAnnotationModel model, INode rootNode) {
- if (!(annotation instanceof SpellingAnnotation)) {
- return false;
- }
- SpellingAnnotation spellingAnnotation = (SpellingAnnotation) annotation;
- Position position = model.getPosition(spellingAnnotation);
- ILeafNode node = findLeafNodeAtOffset(rootNode, position.getOffset());
- return !shouldSpellCheck(node);
- }
-
- private boolean shouldSpellCheck(INode node) {
- if (node == null) {
- return false;
- }
- if (nodes.isComment(node)) {
- return true;
- }
- if (nodes.isString(node)) {
- EObject o = findActualSemanticObjectFor(node);
- return !(o instanceof Import);
- }
- return false;
- }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory.java
index 58f2af2..2b5e833 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/protoc/output/ProtocMarkerFactory.java
@@ -8,7 +8,7 @@
*/
package com.google.eclipse.protobuf.ui.protoc.output;
-import static com.google.eclipse.protobuf.ui.validation.ProtobufResourceUIValidatorExtension.EDITOR_CHECK;
+import static com.google.eclipse.protobuf.ui.validation.MarkerTypes.*;
import static org.eclipse.core.resources.IMarker.*;
import static org.eclipse.core.resources.IResource.DEPTH_INFINITE;
@@ -21,8 +21,6 @@
* @author alruiz@google.com (Alex Ruiz)
*/
public class ProtocMarkerFactory {
- private static final String PROTOC_CHECK = "com.google.eclipse.protobuf.ui.protocMarker";
-
private final IFile protoFile;
private final IMarker[] markers;
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/quickfix/ProtobufQuickAssistProcessor.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/quickfix/ProtobufQuickAssistProcessor.java
deleted file mode 100644
index 2b4296b..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/quickfix/ProtobufQuickAssistProcessor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.quickfix;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static java.util.Collections.emptyList;
-
-import java.util.List;
-
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
-import org.eclipse.ui.texteditor.spelling.SpellingCorrectionProcessor;
-import org.eclipse.xtext.ui.editor.quickfix.XtextQuickAssistProcessor;
-
-import com.google.inject.Inject;
-
-/**
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ProtobufQuickAssistProcessor extends XtextQuickAssistProcessor {
- @Inject private SpellingCorrectionProcessor spellingCorrectionProcessor;
-
- @Override public ICompletionProposal[] computeQuickAssistProposals(IQuickAssistInvocationContext context) {
- List<ICompletionProposal> proposals = newArrayList();
- proposals.addAll(spellingFixes(context));
- proposals.addAll(newArrayList(super.computeQuickAssistProposals(context)));
- return proposals.toArray(new ICompletionProposal[proposals.size()]);
- }
-
- private List<ICompletionProposal> spellingFixes(IQuickAssistInvocationContext context) {
- ICompletionProposal[] spellingFixes = spellingCorrectionProcessor.computeQuickAssistProposals(context);
- if (spellingFixes.length == 0) {
- return emptyList();
- }
- if (spellingFixes.length == 1 && isNoCompletionsProposal(spellingFixes[0])) {
- return emptyList();
- }
- return newArrayList(spellingFixes);
- }
-
- private boolean isNoCompletionsProposal(ICompletionProposal p) {
- return p.getClass().getSimpleName().equals("NoCompletionsProposal");
- }
-}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/MarkerTypes.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/MarkerTypes.java
new file mode 100644
index 0000000..20b3937
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/MarkerTypes.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * 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 com.google.eclipse.protobuf.ui.validation;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public final class MarkerTypes {
+ public static final String EDITOR_CHECK = "com.google.eclipse.protobuf.ui.editorMarker";
+ public static final String PROTOC_CHECK = "com.google.eclipse.protobuf.ui.protocMarker";
+
+ private MarkerTypes() {}
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufMarkerTypeProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufMarkerTypeProvider.java
new file mode 100644
index 0000000..230dcfe
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufMarkerTypeProvider.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2012 Google Inc.
+ *
+ * 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 com.google.eclipse.protobuf.ui.validation;
+
+import static com.google.eclipse.protobuf.ui.validation.MarkerTypes.EDITOR_CHECK;
+
+import org.eclipse.xtext.ui.validation.MarkerTypeProvider;
+import org.eclipse.xtext.validation.Issue;
+
+import com.google.inject.Singleton;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+@Singleton
+public class ProtobufMarkerTypeProvider extends MarkerTypeProvider {
+ @Override public String getMarkerType(Issue issue) {
+ return EDITOR_CHECK;
+ }
+}
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
deleted file mode 100644
index 621d9a6..0000000
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/validation/ProtobufResourceUIValidatorExtension.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2011 Google Inc.
- *
- * 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 com.google.eclipse.protobuf.ui.validation;
-
-import static org.eclipse.core.resources.IResource.DEPTH_ZERO;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.xtext.ui.editor.validation.MarkerCreator;
-import org.eclipse.xtext.ui.validation.DefaultResourceUIValidatorExtension;
-import org.eclipse.xtext.validation.*;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.inject.Inject;
-
-/**
- * Creates/deletes markers of type "Protocol Buffer Problem" instead of the default "Xtext Check."
- *
- * @author alruiz@google.com (Alex Ruiz)
- */
-public class ProtobufResourceUIValidatorExtension extends DefaultResourceUIValidatorExtension {
- public static final String EDITOR_CHECK = "com.google.eclipse.protobuf.ui.editorMarker";
-
- @VisibleForTesting @Inject MarkerCreator markerCreator;
-
- @Override protected void createMarkers(IFile file, List<Issue> list, IProgressMonitor monitor) throws CoreException {
- for (Issue issue : list) {
- markerCreator.createMarker(issue, file, EDITOR_CHECK);
- }
- }
-
- @Override protected void deleteMarkers(IFile file, CheckMode checkMode, IProgressMonitor monitor)
- throws CoreException {
- super.deleteMarkers(file, checkMode, monitor);
- file.deleteMarkers(EDITOR_CHECK, true, DEPTH_ZERO);
- }
-}
diff --git a/com.google.eclipse.protobuf/META-INF/MANIFEST.MF b/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
index 70bcaf1..400a480 100644
--- a/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
+++ b/com.google.eclipse.protobuf/META-INF/MANIFEST.MF
@@ -3,10 +3,10 @@
Eclipse-ExtensibleAPI: true
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 1.2.5.qualifier
+Bundle-Version: 1.3.1.qualifier
Bundle-SymbolicName: com.google.eclipse.protobuf; singleton:=true
Bundle-ActivationPolicy: lazy
-Require-Bundle: org.eclipse.xtext;bundle-version="2.2.1",
+Require-Bundle: org.eclipse.xtext;bundle-version="2.3.0",
org.eclipse.xtext.generator;resolution:=optional,
org.eclipse.emf.codegen.ecore;resolution:=optional,
org.eclipse.emf.mwe.utils;resolution:=optional,