本文整理汇总了Java中org.eclipse.jface.preference.JFacePreferences.getPreferenceStore方法的典型用法代码示例。如果您正苦于以下问题:Java JFacePreferences.getPreferenceStore方法的具体用法?Java JFacePreferences.getPreferenceStore怎么用?Java JFacePreferences.getPreferenceStore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.preference.JFacePreferences
的用法示例。
在下文中一共展示了JFacePreferences.getPreferenceStore方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
PasswordSafeJFace app = PasswordSafeJFace.getApp();
// TODO: this should check if URL is part of sparse fields
PwsEntryBean selected = app.getSelectedRecord();
if (selected == null || selected.getUrl() == null || selected.getUrl().length() == 0)
return;
IOUtils.openBrowser(selected.getUrl());
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
final boolean recordAccessTime = thePrefs
.getBoolean(JpwPreferenceConstants.RECORD_LAST_ACCESS_TIME);
if (recordAccessTime) {// this could/should be sent to a background
// thread
app.updateAccessTime(selected);
}
}
示例2: run
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
PasswordSafeJFace app = PasswordSafeJFace.getApp();
PwsEntryBean selected = app.getSelectedRecord();
if (selected == null)
return;
// retrieve filled Entry, always needed for passwords
PwsEntryBean theEntry = app.getPwsDataStore().getEntry(selected.getStoreIndex());
Clipboard cb = new Clipboard(app.getShell().getDisplay());
app.copyToClipboard(cb, theEntry.getPassword().toString());
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
final boolean recordAccessTime = thePrefs
.getBoolean(JpwPreferenceConstants.RECORD_LAST_ACCESS_TIME);
if (recordAccessTime) { // this could/should be sent to a background
// thread
app.updateAccessTime(theEntry);
}
cb.dispose();
}
示例3: run
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
PasswordSafeJFace app = PasswordSafeJFace.getApp();
// TODO: Probably it will be simpler to call new PwsEntryBean();
PwsEntryBean newEntry = PwsEntryBean.fromPwsRecord(app.getPwsFile().newRecord());
IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(JpwPreferenceConstants.USE_DEFAULT_USERNAME)) {
newEntry.setUsername(thePrefs.getString(JpwPreferenceConstants.DEFAULT_USERNAME));
}
if (app.isTreeViewShowing()) {
// create new entry within existing group
String selectedGroup = app.getSelectedTreeGroupPath();
if (selectedGroup != null && selectedGroup.length() > 0) {
newEntry.setGroup(selectedGroup);
}
}
EditDialog ed = new EditDialog(app.getShell(), newEntry);
newEntry = (PwsEntryBean) ed.open();
if (newEntry != null) {
newEntry.setSparse(false);
app.addRecord(newEntry);
}
}
示例4: createContents
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FillLayout(SWT.VERTICAL));
composite = new Composite(container, SWT.NONE);
composite.setLayout(new FillLayout(SWT.VERTICAL));
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(DISPLAY_AS_LIST_PREF)) {
addTableView(composite);
viewAsListAction.setChecked(true);
viewAsTreeAction.setChecked(false);
} else {
addTreeView(composite);
viewAsTreeAction.setChecked(true);
viewAsListAction.setChecked(false);
}
final SysTray tray = new SysTray();
final boolean isAvailable = tray.init(null);
if (isAvailable) {
systemTray = tray;
}
return container;
}
示例5: setupStatusMessage
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
public void setupStatusMessage() {
final PwsFile pwsf = getPwsFile();
if (pwsf != null && pwsf.getRecordCount() > 0) {
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(JpwPreferenceConstants.DOUBLE_CLICK_COPIES_TO_CLIPBOARD)) {
setStatus(Messages.getString("PasswordSafeJFace.Status.DoubleClickToCopy")); //$NON-NLS-1$
} else {
setStatus(Messages.getString("PasswordSafeJFace.Status.DoubleClickToEdit")); //$NON-NLS-1$
}
} else {
setStatus("http://jpwsafe.sf.net"); //$NON-NLS-1$
}
}
示例6: saveOnUpdateOrEditCheck
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* If the user has set "Save on Update or Edit", we save the file
* immediately.
*
*/
private void saveOnUpdateOrEditCheck() {
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(JpwPreferenceConstants.SAVE_IMMEDIATELY_ON_EDIT)) {
if (log.isDebugEnabled())
log.debug("Save on Edit option active. Saving database."); //$NON-NLS-1$
saveFileAction.run();
}
}
示例7: tidyUpOnExit
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* Perform necessary shutdown operations, regardless of how the user exited
* the application.
*
*/
private void tidyUpOnExit() {
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(JpwPreferenceConstants.CLEAR_CLIPBOARD_ON_MIN)) {
clearClipboardAction.run();
}
thePrefs.setValue(DISPLAY_AS_LIST_PREF, !isTreeViewShowing());
try {
UserPreferences.getInstance().savePreferences();
} catch (final IOException e) {
displayErrorDialog(
Messages.getString("PasswordSafeJFace.SavePrefsError.Title"), Messages.getString("PasswordSafeJFace.SavePrefsError.Message") + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例8: addTableView
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
protected void addTableView(final Composite aComposite) {
tableViewer = new TableViewer(aComposite, SWT.FULL_SELECTION | SWT.BORDER);
tableViewer.addDoubleClickListener(new ViewerDoubleClickListener());
table = tableViewer.getTable();
table.setHeaderVisible(true);
table.setMenu(createPopupMenu(table));
tableViewer.setContentProvider(new PasswordTableContentProvider());
tableViewer.setLabelProvider(new PasswordTableLabelProvider());
tableViewer.setInput(new Object());
tableViewer.setSorter(new PasswordTableSorter());
viewer = tableViewer;
int column = 1;
addTableColumn(column, "PasswordSafeJFace.Column.Title", "table/title"); //$NON-NLS-1$
column++;
addTableColumn(column, "PasswordSafeJFace.Column.UserName", "table/userName"); //$NON-NLS-1$
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(JpwPreferenceConstants.SHOW_NOTES_IN_LIST)) {
column++;
addTableColumn(column, "PasswordSafeJFace.Column.Notes", "table/notes"); //$NON-NLS-1$
}
column++;
addTableColumn(column, "PasswordSafeJFace.Column.LastChanged", "table/lastChange"); //$NON-NLS-1$
// Sort on first column
final PasswordTableSorter pts = (PasswordTableSorter) tableViewer.getSorter();
pts.sortOnColumn(1);
}
示例9: compare
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
@Override
public int compare(final Viewer arg0, final Object a, final Object b) {
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
final boolean showNotes = thePrefs.getBoolean(JpwPreferenceConstants.SHOW_NOTES_IN_LIST);
int rc = 0;
final PwsEntryBean entry1 = (PwsEntryBean) a;
final PwsEntryBean entry2 = (PwsEntryBean) b;
switch (column) {
case 1:
rc = getComparator().compare(entry1.getTitle(), entry2.getTitle());
break;
case 2:
rc = getComparator().compare(entry1.getUsername(), entry2.getUsername());
break;
case 3:
if (showNotes) {
rc = getComparator().compare(entry1.getNotes(), entry2.getNotes());
} else {
rc = getComparator().compare(safeFormatDate(entry1.getLastChange()), safeFormatDate(entry2.getLastChange()));
}
break;
case 4:
rc = getComparator().compare(safeFormatDate(entry1.getLastChange()), safeFormatDate(entry2.getLastChange()));
break;
}
if (direction == DESCENDING)
rc = -rc;
return rc;
}
示例10: run
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
final PasswordSafeJFace app = PasswordSafeJFace.getApp();
final PwsEntryBean selectedRecord = app.getSelectedRecord();
if (selectedRecord != null) {
final PwsEntryBean filledEntry = app.getPwsDataStore().getEntry(
selectedRecord.getStoreIndex());
EditDialog dialogue = new EditDialog(app.getShell(), filledEntry);
app.getLockStatus().addObserver(dialogue);
final PwsEntryBean changedEntry;
try {
changedEntry = (PwsEntryBean) dialogue.open();
} finally {
app.getLockStatus().deleteObserver(dialogue);
}
if (!app.isReadOnly()) {
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
final boolean recordAccessTime = thePrefs
.getBoolean(JpwPreferenceConstants.RECORD_LAST_ACCESS_TIME);
if (changedEntry != null) {
if (recordAccessTime) {
changedEntry.setLastAccess(new Date());
}
app.updateRecord(changedEntry);
} else if (recordAccessTime) { // we still have to update the
// record
filledEntry.setLastAccess(new Date());
app.updateAccessTime(filledEntry);
}
}
}
}
示例11: run
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
// TODO: disable option if v1 or v2; URL only seems to be available in
// V3 files
final PasswordSafeJFace app = PasswordSafeJFace.getApp();
final PwsEntryBean selected = app.getSelectedRecord();
if (selected == null)
return;
// TODO: only fetch a filled entry if URL is not part of sparse fields.
PwsEntryBean theEntry;
if (selected.getUrl() != null && selected.getUrl().length() > 0) {
theEntry = selected;
} else {// retrieve filled Entry for sparse
theEntry = app.getPwsDataStore().getEntry(selected.getStoreIndex());
}
Clipboard cb = new Clipboard(app.getShell().getDisplay());
app.copyToClipboard(cb, theEntry.getUrl());
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
final boolean recordAccessTime = thePrefs
.getBoolean(JpwPreferenceConstants.RECORD_LAST_ACCESS_TIME);
if (recordAccessTime) { // this could/should be sent to a background
// thread
app.updateAccessTime(theEntry);
}
cb.dispose();
}
示例12: run
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
PasswordSafeJFace app = PasswordSafeJFace.getApp();
PwsEntryBean selected = app.getSelectedRecord();
if (selected == null)
return;
// TODO: only fetch a filled entry if username is not part of sparse
// fields (-> never).
PwsEntryBean theEntry;
if (selected.getUsername() != null && selected.getUsername().length() > 0) {
theEntry = selected;
} else {// retrieve filled Entry for sparse
theEntry = app.getPwsDataStore().getEntry(selected.getStoreIndex());
}
Clipboard cb = new Clipboard(app.getShell().getDisplay());
app.copyToClipboard(cb, theEntry.getUsername());
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
final boolean recordAccessTime = thePrefs
.getBoolean(JpwPreferenceConstants.RECORD_LAST_ACCESS_TIME);
if (recordAccessTime) { // this could/should be sent to a background
// thread
app.updateAccessTime(theEntry);
}
cb.dispose();
}
示例13: addTreeView
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
protected void addTreeView(final Composite aComposite) {
treeViewer = new TreeViewer(aComposite, SWT.BORDER);
treeViewer.setLabelProvider(new PasswordTreeLabelProvider());
treeViewer.setContentProvider(new PasswordTreeContentProvider());
treeViewer.setSorter(new ViewerSorter());
treeViewer.addDoubleClickListener(new ViewerDoubleClickListener());
final int operations = DND.DROP_COPY| DND.DROP_MOVE;
final Transfer[] transferTypes = new Transfer[]
{PwsEntryBeanTransfer.getInstance(), TextTransfer.getInstance()};
treeViewer.addDragSupport(operations, transferTypes , new TreeDragListener(treeViewer));
treeViewer.addDropSupport(operations, transferTypes, new TreeDropper(treeViewer));
treeViewer.setComparer(new IElementComparer() {
public boolean equals(final Object a, final Object b) {
if (a instanceof PwsEntryBean && b instanceof PwsEntryBean)
return ((PwsEntryBean) a).getStoreIndex() == (((PwsEntryBean) b)
.getStoreIndex());
else
return a.equals(b);
}
public int hashCode(final Object element) {
if (element instanceof PwsEntryBean)
return ((PwsEntryBean) element).getStoreIndex();
else
return element.hashCode();
}
});
tree = treeViewer.getTree();
tree.setHeaderVisible(true);
tree.setMenu(createPopupMenu(tree));
treeViewer.setInput(new Object());
viewer = treeViewer;
int column = 1;
addTreeColumn(column, "PasswordSafeJFace.Column.Title", "tree/title");//$NON-NLS-1$
column++;
addTreeColumn(column, "PasswordSafeJFace.Column.UserName", "tree/userName");//$NON-NLS-1$
final IPreferenceStore thePrefs = JFacePreferences.getPreferenceStore();
if (thePrefs.getBoolean(JpwPreferenceConstants.SHOW_NOTES_IN_LIST)) {
column++;
addTreeColumn(column, "PasswordSafeJFace.Column.Notes", "tree/notes");//$NON-NLS-1$
}
final TreeColumn[] columns = tree.getColumns();
for (int i = 0; i < columns.length; i++) {
// ps.getDefaultInt("bla");
// columns[i].setWidth(100);
columns[i].setMoveable(true);
}
// treeViewer.setExpandedState(arg0, arg1)
}
示例14: initializeDefaultPreferences
import org.eclipse.jface.preference.JFacePreferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences() {
// Use a scope etc. once we migrate to Eclipse RCP.
// IScopeContext theContext = new DefaultScope();
// For now we simply use:
final IPreferenceStore theStore = JFacePreferences.getPreferenceStore();
// Display
theStore.setDefault(ALWAYS_ON_TOP, false);
theStore.setDefault(SHOW_NOTES_IN_LIST, true);
theStore.setDefault(SHOW_NOTES_IN_EDIT_MODE, true);
theStore.setDefault(SHOW_PASSWORD_IN_EDIT_MODE, false);
theStore.setDefault(SHOW_ICON_IN_SYSTEM_TRAY, false);
theStore.setDefault(TREE_COLUMN_SIZE, 150);
theStore.setDefault(TABLE_COLUMN_SIZE, 150);
// Password Policy
theStore.setDefault(DEFAULT_PASSWORD_LENGTH, 8);
theStore.setDefault(USE_LOWERCASE_LETTERS, true);
theStore.setDefault(USE_UPPERCASE_LETTERS, true);
theStore.setDefault(USE_DIGITS, true);
theStore.setDefault(USE_SYMBOLS, false);
theStore.setDefault(USE_EASY_TO_READ, false);
theStore.setDefault(USE_HEX_ONLY, false);
// User name
theStore.setDefault(USE_DEFAULT_USERNAME, false);
theStore.setDefault(DEFAULT_USERNAME, "");
theStore.setDefault(QUERY_FOR_DEFAULT_USERNAME, false);
// Security
theStore.setDefault(CLEAR_CLIPBOARD_ON_MIN, false);
theStore.setDefault(LOCK_DB_ON_MIN, false);
theStore.setDefault(CONFIRM_SAVE_ON_MIN, false);
theStore.setDefault(CONFIRM_COPY_TO_CLIPBOARD, false);
theStore.setDefault(LOCK_DB_ON_WS_LOCK, true);
theStore.setDefault(LOCK_ON_IDLE, true);
theStore.setDefault(LOCK_ON_IDLE_MINS, 5);
theStore.setDefault(CONFIRM_SAVE_ON_MIN, false);
// Misc
theStore.setDefault(CONFIRM_ITEM_DELETION, true);
theStore.setDefault(SAVE_IMMEDIATELY_ON_EDIT, true);
theStore.setDefault(ESCAPE_KEY_EXITS_APP, false);
theStore.setDefault(HOT_KEY_ACTIVE, false);
theStore.setDefault(HOT_KEY, false);
theStore.setDefault(DOUBLE_CLICK_COPIES_TO_CLIPBOARD, true);
theStore.setDefault(DEFAULT_OPEN_READ_ONLY, false);
theStore.setDefault(RECORD_LAST_ACCESS_TIME, false);
}