本文整理汇总了Java中org.eclipse.jface.preference.JFacePreferences类的典型用法代码示例。如果您正苦于以下问题:Java JFacePreferences类的具体用法?Java JFacePreferences怎么用?Java JFacePreferences使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JFacePreferences类属于org.eclipse.jface.preference包,在下文中一共展示了JFacePreferences类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadPreferences
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
/**
* Loads preferences from a properties file.
*
* @throws IOException if there are problems loading the preferences file
*/
private void loadPreferences() throws IOException {
// props = new Properties();
String userFile = getPreferencesFilename();
if (log.isDebugEnabled())
log.debug("Loading from [" + userFile + "]");
File prefsFile = new File(userFile);
if (!prefsFile.exists()) {
File prefsDir = new File(System.getProperty("user.home") + File.separator + PROPS_DIR);
if (!prefsDir.exists()) {
prefsDir.mkdir();
}
}
prefStore = new PreferenceStore(getPreferencesFilename());
JFacePreferences.setPreferenceStore(prefStore);
new JpwPreferenceInitializer().initializeDefaultPreferences();
if (prefsFile.exists()) {
prefStore.load();
}
// TODO: Check what happens if no file exists?
if (log.isDebugEnabled())
log.debug("Loaded " + prefStore + " preference settings from file");
}
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:31,代码来源:UserPreferences.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();
// 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
示例3: 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
示例4: 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
示例5: initializeDeprecatedColorConstants
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
/**
* Initializes deprecated color constants.
*
* @param store the preference store
* @since 3.6
*/
private static void initializeDeprecatedColorConstants(IPreferenceStore store) {
RGB bgRGB= null;
RGB fgRGB= null;
// Don't fail in headless mode
if (PlatformUI.isWorkbenchRunning()) {
bgRGB= JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR);
fgRGB= JFaceResources.getColorRegistry().getRGB(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);
}
// Workaround for https://bugs.eclipse.org/306736
if (bgRGB == null)
bgRGB= new RGB(255, 255, 255);
if (fgRGB == null)
fgRGB= new RGB(0, 0, 0);
setRGBValue(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, bgRGB);
setRGBValue(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, fgRGB);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:PreferenceConstants.java
示例6: propertyChange
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent event) {
String property= event.getProperty();
if (property.equals(JFacePreferences.QUALIFIER_COLOR)
|| property.equals(JFacePreferences.COUNTER_COLOR)
|| property.equals(JFacePreferences.DECORATIONS_COLOR)
|| property.equals(HIGHLIGHT_BG_COLOR_NAME)
|| property.equals(HIGHLIGHT_WRITE_BG_COLOR_NAME)
|| property.equals(INHERITED_COLOR_NAME)
|| property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)
) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
updateAllViewers();
}
});
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ColoredViewersManager.java
示例7: getStyledText
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
@Override
public StyledString getStyledText(Object element) {
if (element instanceof DataAndImageTreeNode) {
@SuppressWarnings("rawtypes")
DataAndImageTreeNode treeNode = (DataAndImageTreeNode) element;
Object data = treeNode.data;
if (data instanceof HierarchyNodeModel) {
HierarchyNodeModel model = (HierarchyNodeModel) data;
String spaces = " ";
StyledString styledString = new StyledString(model.name + spaces);
if (model.moduleName != null && model.moduleName.trim().length() > 0) {
Styler styler = StyledString.createColorRegistryStyler(JFacePreferences.DECORATIONS_COLOR, null);
styledString.append("(" + model.moduleName + ")", styler);
}
return styledString;
}
return new StyledString(data.toString());
}
return new StyledString(element == null ? "" : element.toString());
}
开发者ID:fabioz,项目名称:Pydev,代码行数:21,代码来源:HierarchyLabelProvider.java
示例8: 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
示例9: 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
示例10: 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
示例11: 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
示例12: 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
示例13: 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
示例14: 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
示例15: 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
示例16: 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
示例17: propertyChange
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent event) {
String property= event.getProperty();
if (property.equals(JFacePreferences.QUALIFIER_COLOR) || property.equals(JFacePreferences.COUNTER_COLOR) || property.equals(JFacePreferences.DECORATIONS_COLOR)
|| property.equals(HIGHLIGHT_BG_COLOR_NAME) || property.equals(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
refresh();
}
});
}
}
开发者ID:angelozerr,项目名称:typescript.java,代码行数:12,代码来源:DecoratingTypeScriptSearchLabelProvider.java
示例18: applyStyles
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
@Override
public void applyStyles(TextStyle textStyle) {
textStyle.font = getItalicFont();
textStyle.foreground = getColor(JFacePreferences.DECORATIONS_COLOR);
if (textStyle instanceof StyleRange) {
((StyleRange) textStyle).fontStyle = SWT.ITALIC;
}
}
开发者ID:insweat,项目名称:hssd,代码行数:9,代码来源:LPHelper.java
示例19: getForeground
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
@Override
public Color getForeground( Object element ) {
IProject project = ( IProject )element;
Color result = null;
if( !projectPatternMatcher.matches( project ) ) {
result = JFaceResources.getColorRegistry().get( JFacePreferences.QUALIFIER_COLOR );
}
return result;
}
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:10,代码来源:PreviewLabelProvider.java
示例20: setHyperlinkValues
import org.eclipse.jface.preference.JFacePreferences; //导入依赖的package包/类
protected void setHyperlinkValues(Theme theme, IEclipsePreferences prefs, boolean revertToDefaults)
{
if (prefs == null || theme == null)
{
return;
}
if (revertToDefaults)
{
// Console preferences
prefs.remove(JFacePreferences.HYPERLINK_COLOR);
prefs.remove(JFacePreferences.ACTIVE_HYPERLINK_COLOR);
// Editor preferences
prefs.remove(DefaultHyperlinkPresenter.HYPERLINK_COLOR_SYSTEM_DEFAULT);
prefs.remove(DefaultHyperlinkPresenter.HYPERLINK_COLOR);
}
else
{
TextAttribute editorHyperlink = theme.getTextAttribute("hyperlink"); //$NON-NLS-1$
prefs.put(JFacePreferences.HYPERLINK_COLOR,
StringConverter.asString(editorHyperlink.getForeground().getRGB()));
JFaceResources.getColorRegistry().put(JFacePreferences.HYPERLINK_COLOR,
editorHyperlink.getForeground().getRGB());
prefs.put(JFacePreferences.ACTIVE_HYPERLINK_COLOR,
StringConverter.asString(editorHyperlink.getForeground().getRGB()));
JFaceResources.getColorRegistry().put(JFacePreferences.ACTIVE_HYPERLINK_COLOR,
editorHyperlink.getForeground().getRGB());
prefs.putBoolean(DefaultHyperlinkPresenter.HYPERLINK_COLOR_SYSTEM_DEFAULT, false);
prefs.put(DefaultHyperlinkPresenter.HYPERLINK_COLOR,
StringConverter.asString(editorHyperlink.getForeground().getRGB()));
}
}
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:37,代码来源:InvasiveThemeHijacker.java
注:本文中的org.eclipse.jface.preference.JFacePreferences类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论