use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class PrefPageDataFormat method performDefaults.
@Override
protected void performDefaults() {
DBPPreferenceStore targetPreferenceStore = getTargetPreferenceStore();
clearPreferences(targetPreferenceStore);
formatterProfile = null;
loadPreferences(targetPreferenceStore);
reloadSample();
super.performDefaults();
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class BinaryEditor method dispose.
/**
* Removes preferences-changed listener
*
* @see WorkbenchPart#dispose()
*/
@Override
public void dispose() {
if (manager != null) {
manager.dispose();
manager = null;
}
DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
store.removePropertyChangeListener(preferencesChangeListener);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
super.dispose();
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class BinaryEditor method createPartControl.
@Override
public void createPartControl(Composite parent) {
IStorage storage = EditorUtils.getStorageFromInput(getEditorInput());
manager = new HexManager();
manager.setTextFont(HexPreferencesPage.getPrefFontData());
manager.setDefWidth(HexPreferencesPage.getDefaultWidth());
manager.setMenuListener(this);
int editorStyle = SWT.NONE;
if (storage != null && storage.isReadOnly()) {
editorStyle = SWT.READ_ONLY;
}
manager.createEditorPart(parent, editorStyle);
FillLayout fillLayout = new FillLayout();
parent.setLayout(fillLayout);
loadBinaryContent();
// Register any global actions with the site's IActionBars.
IActionBars bars = getEditorSite().getActionBars();
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_UNDO);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_REDO);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_CUT);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_COPY);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_PASTE);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_DELETE);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_SELECT_ALL);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
createEditorAction(bars, ITextEditorActionConstants.GOTO_LINE);
manager.addListener(new Listener() {
@Override
public void handleEvent(Event event) {
firePropertyChange(PROP_DIRTY);
updateActionsStatus();
}
});
bars.updateActionBars();
preferencesChangeListener = new DBPPreferenceListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (HexPreferencesPage.PROP_FONT_DATA.equals(event.getProperty())) {
manager.setTextFont((FontData) event.getNewValue());
}
if (HexPreferencesPage.PROP_DEF_WIDTH.equals(event.getProperty())) {
manager.setDefWidth((String) event.getNewValue());
}
}
};
DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
store.addPropertyChangeListener(preferencesChangeListener);
manager.addLongSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (selectionListeners == null)
return;
long[] longSelection = HexEditControl.getLongSelection(e);
SelectionChangedEvent event = new SelectionChangedEvent(BinaryEditor.this, new StructuredSelection(new Object[] { longSelection[0], longSelection[1] }));
for (ISelectionChangedListener selectionListener : selectionListeners) {
selectionListener.selectionChanged(event);
}
}
});
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class HexPreferencesPage method performOk.
/**
* @see HexPreferencesPage#performOk()
*/
@Override
public boolean performOk() {
DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
FontData fontData = preferences.getFontData();
store.setValue(HexEditorPreferences.HEX_FONT_NAME, fontData.getName());
store.setValue(HexEditorPreferences.HEX_FONT_STYLE, fontData.getStyle());
store.setValue(HexEditorPreferences.HEX_FONT_SIZE, fontData.getHeight());
store.firePropertyChangeEvent(PROP_FONT_DATA, null, fontData);
store.setValue(HexEditorPreferences.HEX_DEF_WIDTH, preferences.getDefWidth());
store.firePropertyChangeEvent(PROP_DEF_WIDTH, 0, preferences.getDefWidth());
PrefUtils.savePreferenceStore(store);
return true;
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class HexPreferencesPage method getDefaultWidth.
public static String getDefaultWidth() {
DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
String defWidth = store.getString(HexEditorPreferences.HEX_DEF_WIDTH);
return CommonUtils.isEmpty(defWidth) ? "8" : defWidth;
}
Aggregations