private ListDataProvider<CdmBase> bodyDataProvider;
private BulkEditorE4 bulkEditor;
+ private BulkEditorSearchE4 bulkEditorSearch;
public BulkEditorE4Composite(BulkEditorE4 bulkEditor, Composite parent, int style) {
input.getPropertyKeys().forEach(key->columnList.add(key));
- new BulkEditorSearchE4(this, topComposite, SWT.NONE);
+ bulkEditorSearch = new BulkEditorSearchE4(this, topComposite, SWT.NONE);
//layout needed because the search bar is added after @PostConstuct method
topComposite.getParent().layout();
}
});
+ //register handler for view configuration menu
+ natTable.registerCommandHandler(bulkEditorSearch.getDisplayPersistenceDialogCommandHandler());
+
natTable.configure();
}
}
}
+ NatTable getNatTable() {
+ return natTable;
+ }
+
}
package eu.etaxonomy.taxeditor.bulkeditor.e4;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.eclipse.nebula.widgets.nattable.persistence.command.DisplayPersistenceDialogCommand;
+import org.eclipse.nebula.widgets.nattable.persistence.command.DisplayPersistenceDialogCommandHandler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.ColorResources;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.preference.Resources;
import eu.etaxonomy.taxeditor.store.SearchManager;
+import eu.etaxonomy.taxeditor.workbench.WorkbenchUtility;
/**
* @author p.ciardelli
private final BulkEditorE4Composite editor;
+ private DisplayPersistenceDialogCommandHandler displayPersistenceDialogCommandHandler;
+
+ private Properties natTableState;
+
private Text text;
private Button button;
+ private Button btnManageState;
+
public Object ORDER_BY = new Object();
}
});
+ /**
+ * Table state persistence
+ */
+ natTableState = new Properties();
+ //load persisted state
+ File statePropertiesFile = getStatePropertiesFile();
+ FileInputStream inputStream;
+ try {
+ inputStream = new FileInputStream(statePropertiesFile);
+ natTableState.load(inputStream);
+ } catch (IOException e) {
+ MessagingUtils.info("No initial state properties file found for character matrix"); //$NON-NLS-1$
+ }
+
+ // add settings button
+ displayPersistenceDialogCommandHandler = new DisplayPersistenceDialogCommandHandler(natTableState, editor.getNatTable());
+ btnManageState = new Button(container, SWT.PUSH);
+ btnManageState.setImage(ImageResources.getImage(ImageResources.SETTINGS));
+ btnManageState.setToolTipText(Messages.BulkEditorSearchE4_TABLE_SETTINGS);
+ btnManageState.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ editor.getNatTable().doCommand(new DisplayPersistenceDialogCommand(editor.getNatTable()));
+ }
+ });
+
registerAtFocusService();
}
+ DisplayPersistenceDialogCommandHandler getDisplayPersistenceDialogCommandHandler() {
+ return displayPersistenceDialogCommandHandler;
+ }
+
+ private File getStatePropertiesFile() {
+ return new File(WorkbenchUtility.getBaseLocation(), "bulkeditor_tablestate.properties"); //$NON-NLS-1$
+ }
+
/**
* Handles focus changes for the textfield.
*/