From: p.ciardelli
Date: Tue, 8 Sep 2009 16:57:31 +0000 (+0000)
Subject: Fix #1005 - Display property sheet values in the correct order in Bulk Editor
X-Git-Tag: rcp.ss-first-working-version~668
X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/521d60354b97fc6ab2b6b307a79bff038692be77
Fix #1005 - Display property sheet values in the correct order in Bulk Editor
---
diff --git a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
index 2f48d452b..7d8be5e5c 100644
--- a/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
+++ b/taxeditor-bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
@@ -14,6 +14,9 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.apache.log4j.Logger;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -31,15 +34,22 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.views.properties.IPropertySheetEntry;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheetSorter;
import eu.etaxonomy.taxeditor.annotatedlineeditor.AnnotatedLineEditor;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotation;
import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInput;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.propertysheet.EditorPropertySheetEntry;
+import eu.etaxonomy.taxeditor.propertysheet.PropertySheetUtil;
/**
* @author p.ciardelli
@@ -216,4 +226,42 @@ public class BulkEditor extends AnnotatedLineEditor implements PropertyChangeLis
setInput(getEditorInput());
}
}
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class type) {
+ if (type == IPropertySheetPage.class) {
+ PropertySheetPage page = new EditorPropertySheetPage();
+ return page;
+ }
+ return super.getAdapter(type);
+ }
+
+ class EditorPropertySheetPage extends PropertySheetPage {
+
+ EditorPropertySheetPage() {
+ super();
+
+ // Override sorter to simply display names as first-in-first-out
+ setSorter(new PropertySheetSorter() {
+ public int compare(IPropertySheetEntry entryA, IPropertySheetEntry entryB) {
+ return 0;
+ }
+ public int compareCategories(String categoryA, String categoryB) {
+ return 0;
+ }
+ public void sort(IPropertySheetEntry[] entries) {
+ // do nothing
+ }
+ });
+ }
+
+ public void makeContributions(IMenuManager menuManager,
+ IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+
+ // Remove "Show categories", "Show advanced properties", "Restore default value"
+ toolBarManager.removeAll();
+ menuManager.removeAll();
+ }
+ }
}
\ No newline at end of file