In progress: [Issue 89] Proto buffer editor needs to have options to
remove whitespace at end of lines
Added support for removing trailing whitespace on the entire document.
diff --git a/com.google.eclipse.protobuf.ui/OSGI-INF/l10n/bundle.properties b/com.google.eclipse.protobuf.ui/OSGI-INF/l10n/bundle.properties
index 92ec2f9..273a9fe 100644
--- a/com.google.eclipse.protobuf.ui/OSGI-INF/l10n/bundle.properties
+++ b/com.google.eclipse.protobuf.ui/OSGI-INF/l10n/bundle.properties
@@ -8,6 +8,7 @@
page.name.2 = Compiler
page.name.3 = Import Paths
page.name.4 = Editor
+page.name.5 = Save Actions
keyword.label = Protocol Buffer
command.description = Trigger expensive validation
command.name = Validate
diff --git a/com.google.eclipse.protobuf.ui/plugin.xml b/com.google.eclipse.protobuf.ui/plugin.xml
index 57344bd..6fdc940 100644
--- a/com.google.eclipse.protobuf.ui/plugin.xml
+++ b/com.google.eclipse.protobuf.ui/plugin.xml
@@ -69,8 +69,12 @@
</page>
<page category="com.google.eclipse.protobuf.Protobuf"
class="com.google.eclipse.protobuf.ui.ProtobufExecutableExtensionFactory:com.google.eclipse.protobuf.ui.preferences.pages.editor.EditorPreferencePage"
- id="com.google.eclipse.protobuf.ui.preferences.pages.editor"
- name="%page.name.4">
+ id="com.google.eclipse.protobuf.ui.preferences.pages.editor" name="%page.name.4">
+ <keywordReference id="com.google.eclipse.protobuf.ui.keyword_Protobuf" />
+ </page>
+ <page category="com.google.eclipse.protobuf.ui.preferences.pages.editor"
+ class="com.google.eclipse.protobuf.ui.ProtobufExecutableExtensionFactory:com.google.eclipse.protobuf.ui.preferences.pages.editor.save.SaveActionsPreferencePage"
+ id="com.google.eclipse.protobuf.ui.preferences.pages.editor" name="%page.name.5">
<keywordReference id="com.google.eclipse.protobuf.ui.keyword_Protobuf" />
</page>
</extension>
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 43c431f..32ff714 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
@@ -40,6 +40,7 @@
import com.google.eclipse.protobuf.ui.outline.ProtobufOutlinePage;
import com.google.eclipse.protobuf.ui.preferences.PreferenceStoreAccess;
import com.google.eclipse.protobuf.ui.preferences.pages.compiler.CompilerPreferenceStoreInitializer;
+import com.google.eclipse.protobuf.ui.preferences.pages.editor.save.SaveActionsPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.preferences.pages.general.GeneralPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.preferences.pages.paths.PathsPreferenceStoreInitializer;
import com.google.eclipse.protobuf.ui.scoping.FileUriResolver;
@@ -96,6 +97,10 @@
configurePreferenceInitializer(binder, "pathsPreferences", PathsPreferenceStoreInitializer.class);
}
+ public void configureSaveActionsPreferencesInitializer(Binder binder) {
+ configurePreferenceInitializer(binder, "saveActionsPreferences", SaveActionsPreferenceStoreInitializer.class);
+ }
+
private void configurePreferenceInitializer(Binder binder, String name,
Class<? extends IPreferenceStoreInitializer> initializerType) {
binder.bind(IPreferenceStoreInitializer.class).annotatedWith(named(name)).to(initializerType);
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtocCommandFactory.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtocCommandFactory.java
index efa8277..ec2694d 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtocCommandFactory.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/builder/ProtocCommandFactory.java
@@ -10,12 +10,11 @@
import static com.google.eclipse.protobuf.util.CommonWords.space;
-import java.util.*;
+import com.google.eclipse.protobuf.ui.preferences.pages.compiler.SupportedLanguage;
import org.eclipse.core.resources.*;
-import com.google.eclipse.protobuf.ui.preferences.pages.compiler.SupportedLanguage;
-import com.google.eclipse.protobuf.util.CommonWords;
+import java.util.*;
/**
* @author alruiz@google.com (Alex Ruiz)
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java
index 096238b..72388c3 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/ProtobufDocumentProvider.java
@@ -1,9 +1,10 @@
/*
* 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
- *
+ *
+ * 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.model;
@@ -16,27 +17,30 @@
import static org.eclipse.core.runtime.IStatus.ERROR;
import static org.eclipse.emf.common.util.URI.createURI;
import static org.eclipse.emf.ecore.resource.ContentHandler.UNSPECIFIED_CONTENT_TYPE;
+import static org.eclipse.text.undo.DocumentUndoManagerRegistry.getDocumentUndoManager;
import static org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences;
import static org.eclipse.xtext.resource.XtextResource.OPTION_ENCODING;
import static org.eclipse.xtext.util.CancelIndicator.NullImpl;
-import java.io.*;
-import java.net.URI;
+import com.google.eclipse.protobuf.ui.util.Resources;
+import com.google.inject.Inject;
import org.eclipse.core.filesystem.*;
import org.eclipse.core.runtime.*;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.*;
import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.ui.IURIEditorInput;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.undo.IDocumentUndoManager;
+import org.eclipse.ui.*;
import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.model.*;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;
import org.eclipse.xtext.util.StringInputStream;
-import com.google.eclipse.protobuf.ui.util.*;
-import com.google.inject.Inject;
+import java.io.*;
+import java.net.URI;
/**
* @author alruiz@google.com (Alex Ruiz)
@@ -45,6 +49,7 @@
@Inject private IResourceSetProvider resourceSetProvider;
@Inject private Resources resources;
+ @Inject private SaveActions saveActions;
@Override protected ElementInfo createElementInfo(Object element) throws CoreException {
if (element instanceof FileStoreEditorInput) return createElementInfo((FileStoreEditorInput) element);
@@ -138,4 +143,29 @@
resolveLazyCrossReferences(resource, NullImpl);
return resource;
}
+
+ @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document,
+ boolean overwrite) throws CoreException {
+ if (element instanceof IFileEditorInput) performSaveActions(document);
+ super.doSaveDocument(monitor, element, document, overwrite);
+ }
+
+ private void performSaveActions(IDocument document) throws CoreException {
+ TextEdit edit = saveActions.createSaveAction(document, new IRegion[] { allOf(document) });
+ if (edit == null) return;
+ try {
+ IDocumentUndoManager manager = getDocumentUndoManager(document);
+ manager.beginCompoundChange();
+ edit.apply(document);
+ manager.endCompoundChange();
+ } catch (Exception e) {
+ String message = e.getMessage();
+ if (message == null) message = e.getClass().getSimpleName();
+ throw new CoreException(new Status(ERROR, PLUGIN_ID, message, e));
+ }
+ }
+
+ private Region allOf(IDocument document) {
+ return new Region(0, document.getLength());
+ }
}
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
new file mode 100644
index 0000000..e72b868
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/editor/model/SaveActions.java
@@ -0,0 +1,71 @@
+/*
+ * 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.model;
+
+import static java.lang.Character.isWhitespace;
+import static org.eclipse.jface.text.IDocumentExtension3.DEFAULT_PARTITIONING;
+import static org.eclipse.jface.text.TextUtilities.getPartition;
+
+import com.google.eclipse.protobuf.ui.preferences.pages.editor.save.*;
+import com.google.inject.*;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.text.*;
+import org.eclipse.text.edits.*;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+@Singleton
+class SaveActions {
+
+ @Inject private SaveActionsPreferencesFactory preferencesFactory;
+
+ private static Logger logger = Logger.getLogger(SaveActions.class);
+
+ TextEdit createSaveAction(IDocument document, IRegion[] changedRegions) {
+ SaveActionsPreferences preferences = preferencesFactory.preferences();
+ if (!preferences.shouldRemoveTrailingSpace()) return null;
+ TextEdit rootEdit = null;
+ try {
+ for (IRegion region : changedRegions) {
+ int lastLine = document.getLineOfOffset(region.getOffset() + region.getLength());
+ for (int line = firstLine(region, document); line <= lastLine; line++) {
+ IRegion lineRegion = document.getLineInformation(line);
+ if (lineRegion.getLength() == 0) continue;
+ int lineStart = lineRegion.getOffset();
+ int lineEnd = lineStart + lineRegion.getLength();
+ int charPos = rightMostNonWhitespaceChar(document, lineStart, lineEnd);
+ if (charPos >= lineEnd) continue;
+ // check partition - don't remove whitespace inside strings
+ ITypedRegion partition = getPartition(document, DEFAULT_PARTITIONING, charPos, false);
+ if ("__string".equals(partition.getType())) continue;
+ if (rootEdit == null) rootEdit = new MultiTextEdit();
+ rootEdit.addChild(new DeleteEdit(charPos, lineEnd - charPos));
+ }
+ }
+ } catch (BadLocationException e) {
+ logger.warn("Unable to create save actions", e);
+ }
+ return rootEdit;
+ }
+
+ private int firstLine(IRegion region, IDocument document) throws BadLocationException {
+ return document.getLineOfOffset(region.getOffset());
+ }
+
+ private int rightMostNonWhitespaceChar(IDocument document, int lineStart, int lineEnd) throws BadLocationException {
+ int charPos = lineEnd - 1;
+ while (charPos >= lineStart && isWhitespace(document.getChar(charPos))) {
+ charPos--;
+ }
+ return ++charPos;
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/grammar/CompoundElement.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/grammar/CompoundElement.java
index 03b555e..258065a 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/grammar/CompoundElement.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/grammar/CompoundElement.java
@@ -12,7 +12,6 @@
import static com.google.eclipse.protobuf.util.CommonWords.space;
import com.google.eclipse.protobuf.grammar.CommonKeyword;
-import com.google.eclipse.protobuf.util.CommonWords;
/**
* Element composed of one or more keywords.
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/PreferenceAndPropertyPage.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/PreferenceAndPropertyPage.java
index c5b5c80..b1a8690 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/PreferenceAndPropertyPage.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/PreferenceAndPropertyPage.java
@@ -49,7 +49,7 @@
@Override protected final Control createContents(Composite parent) {
Composite contents = contentParent(parent);
doCreateContents(contents);
- if (isPropertyPage()) setupBtnEnabledProjectSettingsBinding();
+ if (isPropertyPage()) setupBindingOfBtnEnabledProjectSettings();
setupBinding(preferenceBinder);
preferenceBinder.applyValues();
updateContents();
@@ -120,7 +120,7 @@
*/
protected abstract void doCreateContents(Composite parent);
- private void setupBtnEnabledProjectSettingsBinding() {
+ private void setupBindingOfBtnEnabledProjectSettings() {
BooleanPreference preference = enableProjectSettingsPreference(getPreferenceStore());
if (preference == null) return;
preferenceBinder.add(bindSelectionOf(btnEnableProjectSettings).to(preference));
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/RawPreferences.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/RawPreferences.java
new file mode 100644
index 0000000..3436e56
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/RawPreferences.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011 Google Inc.
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse 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.preferences.pages.editor.save;
+
+import com.google.eclipse.protobuf.ui.preferences.BooleanPreference;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+class RawPreferences {
+
+ private final BooleanPreference removeTrailingWhitespace;
+
+ RawPreferences(IPreferenceStore store) {
+ removeTrailingWhitespace = new BooleanPreference("saveActions.removeTrailingWhitespace", store);
+ }
+
+ BooleanPreference removeTrailingWhitespace() {
+ return removeTrailingWhitespace;
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferencePage.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferencePage.java
new file mode 100644
index 0000000..2b9c858
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferencePage.java
@@ -0,0 +1,76 @@
+/*
+ * 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.preferences.pages.editor.save;
+
+import static com.google.eclipse.protobuf.ui.preferences.binding.BindingToButtonSelection.bindSelectionOf;
+
+import com.google.eclipse.protobuf.ui.preferences.binding.*;
+import com.google.inject.Inject;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.*;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+import org.eclipse.swt.SWT;
+
+/**
+ * "Save Actions" preference page.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class SaveActionsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+ public SaveActionsPreferencePage() {
+ }
+
+ @Inject private IPreferenceStoreAccess preferenceStoreAccess;
+
+ private final PreferenceBinder preferenceBinder = new PreferenceBinder();
+
+ private Button btnRemoveTrailingwhitespace;
+
+ /** {@inheritDoc} */
+ public void init(IWorkbench workbench) {}
+
+ @Override protected Control createContents(Composite parent) {
+ Composite contents = new Composite(parent, NONE);
+ contents.setLayout(new GridLayout(1, false));
+ btnRemoveTrailingwhitespace = new Button(contents, SWT.CHECK);
+ btnRemoveTrailingwhitespace.setText("Remove trailing &whitespace");
+ setUpBinding();
+ preferenceBinder.applyValues();
+ return contents;
+ }
+
+ private void setUpBinding() {
+ RawPreferences preferences = new RawPreferences(getPreferenceStore());
+ preferenceBinder.addAll(
+ bindSelectionOf(btnRemoveTrailingwhitespace).to(preferences.removeTrailingWhitespace())
+ );
+ }
+
+ /**
+ * Returns the preference store of this preference page.
+ * @return the preference store.
+ */
+ @Override protected final IPreferenceStore doGetPreferenceStore() {
+ return preferenceStoreAccess.getWritablePreferenceStore();
+ }
+
+ @Override public final boolean performOk() {
+ preferenceBinder.saveValues();
+ return true;
+ }
+
+ @Override protected final void performDefaults() {
+ preferenceBinder.applyDefaults();
+ super.performDefaults();
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferenceStoreInitializer.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferenceStoreInitializer.java
new file mode 100644
index 0000000..a2f245b
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferenceStoreInitializer.java
@@ -0,0 +1,27 @@
+/*
+ * 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.preferences.pages.editor.save;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.xtext.ui.editor.preferences.*;
+
+/**
+ * Initializes default values for the "Paths" preferences.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class SaveActionsPreferenceStoreInitializer implements IPreferenceStoreInitializer {
+
+ /** {@inheritDoc} */
+ public void initialize(IPreferenceStoreAccess access) {
+ IPreferenceStore store = access.getWritablePreferenceStore();
+ RawPreferences preferences = new RawPreferences(store);
+ preferences.removeTrailingWhitespace().defaultValue(false);
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferences.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferences.java
new file mode 100644
index 0000000..0da70ef
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferences.java
@@ -0,0 +1,29 @@
+/*
+ * 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.preferences.pages.editor.save;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * "Save actions" preferences, retrieved from an <code>{@link IPreferenceStore}</code>.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class SaveActionsPreferences {
+
+ private final boolean removeTrailingSpace;
+
+ SaveActionsPreferences(RawPreferences preferences) {
+ removeTrailingSpace = preferences.removeTrailingWhitespace().value();
+ }
+
+ public boolean shouldRemoveTrailingSpace() {
+ return removeTrailingSpace;
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferencesFactory.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferencesFactory.java
new file mode 100644
index 0000000..e8edc4b
--- /dev/null
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/editor/save/SaveActionsPreferencesFactory.java
@@ -0,0 +1,29 @@
+/*
+ * 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.preferences.pages.editor.save;
+
+import com.google.inject.Inject;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.xtext.ui.editor.preferences.IPreferenceStoreAccess;
+
+/**
+ * Factory of <code>{@link SaveActionsPreferences}</code>.
+ *
+ * @author alruiz@google.com (Alex Ruiz)
+ */
+public class SaveActionsPreferencesFactory {
+
+ @Inject private IPreferenceStoreAccess storeAccess;
+
+ public SaveActionsPreferences preferences() {
+ IPreferenceStore store = storeAccess.getWritablePreferenceStore();
+ return new SaveActionsPreferences(new RawPreferences(store));
+ }
+}
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/general/GeneralPreferencePage.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/general/GeneralPreferencePage.java
index daf86a3..a6ceeae 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/general/GeneralPreferencePage.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/general/GeneralPreferencePage.java
@@ -25,8 +25,6 @@
* @author alruiz@google.com (Alex Ruiz)
*/
public class GeneralPreferencePage extends PreferenceAndPropertyPage {
- public GeneralPreferencePage() {
- }
private static final String PREFERENCE_PAGE_ID = "com.google.eclipse.protobuf.Protobuf";
diff --git a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/paths/PathsPreferences.java b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/paths/PathsPreferences.java
index cf5b6e0..7575d39 100644
--- a/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/paths/PathsPreferences.java
+++ b/com.google.eclipse.protobuf.ui/src/com/google/eclipse/protobuf/ui/preferences/pages/paths/PathsPreferences.java
@@ -18,8 +18,7 @@
import org.eclipse.jface.preference.IPreferenceStore;
/**
- * Paths preferences, retrieved from an <code>{@link IPreferenceStore}</code>. To create a new instance invoke
- * <code>{@link PathsPreferencesFactory#preferences(IProject)}</code>
+ * Paths preferences, retrieved from an <code>{@link IPreferenceStore}</code>.
*
* @author alruiz@google.com (Alex Ruiz)
*/
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 b4ca2e7..7cb6c9a 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
@@ -122,7 +122,6 @@
return (adapter == null) ? null : (IResource) adapter;
}
-
private IPath pathOf(URI uri) {
String platformUri = uri.toPlatformString(true);
return (platformUri != null) ? new Path(platformUri) : null;