本文整理汇总了Java中org.eclipse.jface.preference.IPreferenceStore类的典型用法代码示例。如果您正苦于以下问题:Java IPreferenceStore类的具体用法?Java IPreferenceStore怎么用?Java IPreferenceStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPreferenceStore类属于org.eclipse.jface.preference包,在下文中一共展示了IPreferenceStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: intializeBuilderPreferences
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
private void intializeBuilderPreferences(IPreferenceStore store) {
for (CompilerDescriptor compilerDescriptor : compositeGenerator.getCompilerDescriptors()) {
for (CompilerProperties prop : CompilerProperties.values()) {
if (prop.getType() == Boolean.class) {
store.setDefault(
prop.getKey(compilerDescriptor.getIdentifier()),
(Boolean) prop.getValueInCompilerDescriptor(compilerDescriptor,
compilerDescriptor.getIdentifier()));
} else {
store.setDefault(
prop.getKey(compilerDescriptor.getIdentifier()),
(String) prop.getValueInCompilerDescriptor(compilerDescriptor,
compilerDescriptor.getIdentifier()));
}
}
}
}
示例2: BatchSourceViewerConfiguration
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
/**
* Creates configuration by given adaptable
*
* @param adaptable
* must provide {@link ColorManager} and {@link IFile}
*/
public BatchSourceViewerConfiguration(IAdaptable adaptable) {
IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
this.fPreferenceStore = new ChainedPreferenceStore(
new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });
Assert.isNotNull(adaptable, "adaptable may not be null!");
this.annotationHoover = new BatchEditorAnnotationHoover();
this.contentAssistant = new ContentAssistant();
contentAssistProcessor = new BatchEditorSimpleWordContentAssistProcessor();
contentAssistant.enableColoredLabels(true);
contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
for (BatchDocumentIdentifier identifier: BatchDocumentIdentifiers.values()){
contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
}
contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());
this.colorManager = adaptable.getAdapter(ColorManager.class);
Assert.isNotNull(colorManager, " adaptable must support color manager");
this.defaultTextAttribute = new TextAttribute(
colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
this.adaptable=adaptable;
}
示例3: contributeToPreferenceStore
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
public static IPreferenceStore contributeToPreferenceStore(ITextEditor textEditor,
IPreferenceStore preferenceStore) {
try {
// Get old store
IPreferenceStore oldStore = getPreferenceStore(textEditor);
// Create chained store with preference store to add
IPreferenceStore newStore = new ChainedPreferenceStore(
new IPreferenceStore[] { preferenceStore, oldStore });
// Update the text editor with new preference store
setPreferenceStoreOfTextEditor(textEditor, newStore);
// Update the source viewer configuration with new preference store
setPreferenceStoreOfSourceViewerConfiguration(textEditor, newStore);
return newStore;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例4: openContentStream
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
/**
* Returns the content of the .editorconfig file to generate.
*
* @param container
*
* @return the content of the .editorconfig file to generate.
*/
private InputStream openContentStream(IContainer container) {
IPreferenceStore store = EditorsUI.getPreferenceStore();
boolean spacesForTabs = store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS);
int tabWidth = store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH);
String lineDelimiter = getLineDelimiter(container);
String endOfLine = org.ec4j.core.model.PropertyType.EndOfLineValue.ofEndOfLineString(lineDelimiter).name();
StringBuilder content = new StringBuilder("# EditorConfig is awesome: http://EditorConfig.org");
content.append(lineDelimiter);
content.append(lineDelimiter);
content.append("[*]");
content.append(lineDelimiter);
content.append("indent_style = ");
content.append(spacesForTabs ? "space" : "tab");
content.append(lineDelimiter);
content.append("indent_size = ");
content.append(tabWidth);
if (endOfLine != null) {
content.append(lineDelimiter);
content.append("end_of_line = ");
content.append(endOfLine);
}
return new ByteArrayInputStream(content.toString().getBytes());
}
示例5: createTextControl
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
private void createTextControl(String slabel, final String propName, Composite content) {
final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
final Label label = new Label(content, SWT.NONE);
label.setText(slabel);
final Text text = new Text(content, SWT.BORDER);
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
text.setText(store.getString(propName));
text.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
store.setValue(propName, text.getText());
}
});
}
示例6: openQueueMonitor
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
private void openQueueMonitor() throws UnsupportedEncodingException {
final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
String bundle = store.getString(BUNDLE);
String bean = store.getString(BEAN);
String sqn = store.getString(STATUS_QUEUE);
String stn = store.getString(STATUS_TOPIC);
String submit = store.getString(SUBMIT_QUEUE);
String part = store.getString(PART_NAME);
String queueViewId = QueueViews.createSecondaryId(bundle,bean, sqn, stn, submit);
queueViewId = queueViewId+"partName="+part;
try {
Util.getPage().showView(StatusQueueView.ID, queueViewId, IWorkbenchPage.VIEW_VISIBLE);
} catch (PartInitException e) {
ErrorDialog.openError(Display.getDefault().getActiveShell(), "Cannot open view", "Cannot open view "+queueViewId,
new Status(Status.ERROR, "org.eclipse.scanning.event.ui", e.getMessage()));
logger.error("Cannot open view", e);
}
}
示例7: BashSourceViewerConfiguration
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
/**
* Creates configuration by given adaptable
*
* @param adaptable
* must provide {@link ColorManager} and {@link IFile}
*/
public BashSourceViewerConfiguration(IAdaptable adaptable) {
IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
this.fPreferenceStore = new ChainedPreferenceStore(
new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });
Assert.isNotNull(adaptable, "adaptable may not be null!");
this.annotationHoover = new BashEditorAnnotationHoover();
this.contentAssistant = new ContentAssistant();
contentAssistProcessor = new BashEditorSimpleWordContentAssistProcessor();
contentAssistant.enableColoredLabels(true);
contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
for (BashDocumentIdentifier identifier: BashDocumentIdentifiers.values()){
contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
}
contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());
this.colorManager = adaptable.getAdapter(ColorManager.class);
Assert.isNotNull(colorManager, " adaptable must support color manager");
this.defaultTextAttribute = new TextAttribute(
colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
this.adaptable=adaptable;
}
示例8: performOk
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
/**
* @see PreferencePage#performOk
*/
@Override
public boolean performOk()
{
if( !modified )
{
return true;
}
StructuredSelection selection = (StructuredSelection) listViewer.getSelection();
IProject project = (IProject) selection.getFirstElement();
if( project != null )
{
IPreferenceStore prefs = getPreferenceStore();
prefs.setValue(JPFClasspathPlugin.PREF_REGISTRY_NAME, project.getName());
try
{
((IPersistentPreferenceStore) prefs).save();
}
catch( IOException e )
{
JPFClasspathLog.logError(e);
}
}
return true;
}
示例9: chooseDbSource
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
public static File chooseDbSource(Shell shell, IPreferenceStore prefStore, boolean dir) {
String pathToDump = dir ? getDirPath(shell, prefStore) : getFilePath(shell, prefStore);
if (pathToDump == null) {
return null;
}
File dumpFile = new File(pathToDump);
Deque<File> dumpHistory = stringToDumpFileHistory(prefStore.getString(PREF.DB_STORE_FILES));
dumpHistory.addFirst(dumpFile);
while (dumpHistory.size() > MAX_FILES_HISTORY) {
dumpHistory.removeLast();
}
prefStore.setValue(PREF.DB_STORE_FILES, dumpFileHistoryToPreference(dumpHistory));
prefStore.setValue(PREF.LAST_OPENED_LOCATION,
dir ? dumpFile.getAbsolutePath() : dumpFile.getParent());
return dumpFile;
}
示例10: setAutoBuildEnabled
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
@Override
public void setAutoBuildEnabled(Object context, boolean enabled) {
IPreferenceStore preferenceStore = preferenceStoreAccess.getWritablePreferenceStore(context);
String key = null;
for (CompilerDescriptor compilerDescriptor : compositeGenerator.getCompilerDescriptors()) {
key = CompilerProperties.IS_ACTIVE.getKey(compilerDescriptor.getIdentifier());
preferenceStore.setValue(key, enabled);
}
}
示例11: doCreateField
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
/**
* The field have to use OUTPUT_PREFERENCE_TAG as name as the chain of field editor make up the full qualified name
* of the field editors contained by this field editor
*/
private ComponentDetailsFieldEditor doCreateField(IPreferenceStore preferenceStore) {
return new ComponentDetailsFieldEditor(
CompilerProperties.OUTPUT_PREFERENCE_TAG,
"Registered compilers", getFieldEditorParent(), preferenceStore, components) {
@Override
protected IComponentProperties<?>[] getComponentProperties() {
return getComponentPropertiesValues();
}
};
}
示例12: createFieldEditors
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
@Override
protected void createFieldEditors() {
refreshAttributes();
IPreferenceStore preferenceStore = preferenceStoreAccessImpl.getWritablePreferenceStore(getProject());
field = doCreateField(preferenceStore);
addField(field);
}
示例13: create
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
private static IReconcilingStrategy create(IPreferenceStore preferenceStore, IResource resource) {
if (EditorConfigConstants.EDITORCONFIG.equals(resource.getName())) {
// it's an .editorconfig file, add validation
CompositeReconcilingStrategy strategy = new CompositeReconcilingStrategy();
strategy.setReconcilingStrategies(new IReconcilingStrategy[] { new ValidateEditorConfigStrategy(resource),
new ValidateAppliedOptionsStrategy(preferenceStore, resource), new EditorConfigFoldingStrategy() });
return strategy;
}
return new ValidateAppliedOptionsStrategy(preferenceStore, resource);
}
示例14: setDescriptorValuesFromPreferences
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
private void setDescriptorValuesFromPreferences(IPreferenceStore preferenceStore, String outputName,
DESCR_TYPE newCompilerDescriptor) {
for (IComponentProperties<DESCR_TYPE> prop : getComponentPropertiesValues()) {
if (preferenceStore.contains(prop.getKey(outputName))) {
if (prop.getType() == Boolean.class) {
prop.setValueInCompilerDescriptor(newCompilerDescriptor, outputName,
preferenceStore.getBoolean(prop.getKey(outputName)));
} else { // String
prop.setValueInCompilerDescriptor(newCompilerDescriptor, outputName,
preferenceStore.getString(prop.getKey(outputName)));
}
}
}
}
示例15: getPreferenceStores
import org.eclipse.jface.preference.IPreferenceStore; //导入依赖的package包/类
/**
* @return the preference stores associated with the field editors (they store their values in separate preference
* stores)
*/
public List<IPreferenceStore> getPreferenceStores() {
List<IPreferenceStore> stores = new ArrayList<>();
for (FieldEditor field : fields) {
stores.add(field.getPreferenceStore());
}
return stores;
}