当前位置: 首页>>代码示例>>Java>>正文


Java JFacePreferences.getPreferenceStore方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:23,代码来源:OpenUrlAction.java

示例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();
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:28,代码来源:CopyPasswordAction.java

示例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);
	}

}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:28,代码来源:AddRecordAction.java

示例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;
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:30,代码来源:PasswordSafeJFace.java

示例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$
		}

	}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:16,代码来源:PasswordSafeJFace.java

示例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();
	}
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:14,代码来源:PasswordSafeJFace.java

示例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$
	}
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:20,代码来源:PasswordSafeJFace.java

示例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);

}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:34,代码来源:PasswordSafeJFace.java

示例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;
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:38,代码来源:PasswordTableSorter.java

示例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);
			}
		}
	}

}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:37,代码来源:EditRecordAction.java

示例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();
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:36,代码来源:CopyURLAction.java

示例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();
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:35,代码来源:CopyUsernameAction.java

示例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)

}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:56,代码来源:PasswordSafeJFace.java

示例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);

}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:53,代码来源:JpwPreferenceInitializer.java


注:本文中的org.eclipse.jface.preference.JFacePreferences.getPreferenceStore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。