本文整理匯總了Java中org.eclipse.ui.editors.text.EditorsUI.getPreferenceStore方法的典型用法代碼示例。如果您正苦於以下問題:Java EditorsUI.getPreferenceStore方法的具體用法?Java EditorsUI.getPreferenceStore怎麽用?Java EditorsUI.getPreferenceStore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.editors.text.EditorsUI
的用法示例。
在下文中一共展示了EditorsUI.getPreferenceStore方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: BatchSourceViewerConfiguration
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的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;
}
示例2: BashSourceViewerConfiguration
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的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;
}
示例3: openContentStream
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的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());
}
示例4: initializeDefaultPreferences
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = BfActivator.getDefault().getPreferenceStore();
store.setDefault(TEMPLATE_KEY, "");
IPreferenceStore editorStore = EditorsUI.getPreferenceStore();
editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS, true);
editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_CARET, false);
editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_ENCLOSING, false);
PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY));
PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_KEY_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_MAGENTA));
PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_OTHER_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY));
PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_COMMENT_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GREEN));
PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_TEMPLATE_PARAMS_COLOR, getSystemColorRGB(SWT.COLOR_BLUE));
editorStore.setDefault(EditorConstants.PREF_EDITOR_CLOSE_BRACKET, true);
}
示例5: createSourceViewer
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
@Override
protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler, int styles) {
ISourceViewer sourceViewer = super.createSourceViewer(parent, ruler, styles);
// Apply preference settings from the default editor
IPreferenceStore store = EditorsUI.getPreferenceStore();
Color backgroundColor = PreferenceUtils.colorFromString(
store.getString(PREFERENCE_COLOR_BACKGROUND));
Color foregroundColor = PreferenceUtils.colorFromString(
store.getString(PREFERENCE_COLOR_FOREGROUND));
Color selectionBackgroundColor = PreferenceUtils.colorFromString(
store.getString(PREFERENCE_COLOR_SELECTION_BACKGROUND), new RGB(99, 99, 99));
Color selectionForegroundColor = PreferenceUtils.colorFromString(
store.getString(PREFERENCE_COLOR_SELECTION_FOREGROUND), new RGB(0, 0, 0));
final StyledText textWidget = sourceViewer.getTextWidget();
textWidget.setBackground(backgroundColor);
textWidget.setForeground(foregroundColor);
textWidget.setSelectionBackground(selectionBackgroundColor);
textWidget.setSelectionForeground(selectionForegroundColor);
return sourceViewer;
}
示例6: createPreviewer
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
private NSISSourceViewer createPreviewer(Composite parent)
{
NSISSourceViewer previewer = new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL
| SWT.BORDER | SWT.WRAP);
NSISTextUtility.hookSourceViewer(previewer);
SourceViewerConfiguration configuration = new NSISSourceViewerConfiguration(
new ChainedPreferenceStore(new IPreferenceStore[] { NSISPreferences.getInstance().getPreferenceStore(),
EditorsUI.getPreferenceStore() }));
previewer.configure(configuration);
new NSISDocumentSetupParticipant().setup(mCommandDoc);
previewer.setDocument(mCommandDoc);
previewer.setEditable(false);
final StyledText textWidget = previewer.getTextWidget();
textWidget.getCaret().setVisible(false);
textWidget.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e)
{
textWidget.setSelectionRange(e.x, 0);
}
});
return previewer;
}
示例7: createPreviewer
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
private Control createPreviewer(Composite parent)
{
mPreviewer= new NSISSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
NSISTextUtility.hookSourceViewer(mPreviewer);
SourceViewerConfiguration configuration= new NSISSourceViewerConfiguration(new ChainedPreferenceStore(new IPreferenceStore[]{mPreferenceStore,getPreferenceStore(), EditorsUI.getPreferenceStore()}));
mPreviewer.configure(configuration);
InputStream is = null;
String content= ""; //$NON-NLS-1$
try {
is = getClass().getResourceAsStream("NSISPreview.txt"); //$NON-NLS-1$
content= new String(IOUtility.loadContentFromStream(is));
}
catch(Exception e) {
EclipseNSISPlugin.getDefault().log(e);
}
finally {
IOUtility.closeIO(is);
}
IDocument document= new Document(content);
new NSISDocumentSetupParticipant().setup(document);
mPreviewer.setDocument(document);
mPreviewer.setEditable(false);
return mPreviewer.getControl();
}
示例8: createViewer
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
@Override
protected SourceViewer createViewer(Composite parent)
{
mViewer = new NSISTemplateSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
NSISTextUtility.hookSourceViewer(mViewer);
SourceViewerConfiguration configuration = new NSISTemplateSourceViewerConfiguration(new ChainedPreferenceStore(
new IPreferenceStore[] { getPreferenceStore(), EditorsUI.getPreferenceStore() }));
mViewer.configure(configuration);
IDocument document = new Document();
new NSISDocumentSetupParticipant().setup(document);
mViewer.setDocument(document);
mViewer.setEditable(false);
return mViewer;
}
示例9: DecoratedScriptEditor
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
/**
* Constructs a decorated script editor with the specified parent and the
* specified script.
*
* @param parent
* the parent editor.
* @param script
* the script to edit
*/
public DecoratedScriptEditor( IEditorPart parent, String script )
{
super( );
this.parent = parent;
this.sourceViewerConfiguration = new ScriptSourceViewerConfiguration( context );
setSourceViewerConfiguration( this.sourceViewerConfiguration );
setDocumentProvider( new ScriptDocumentProvider( parent ) );
setScript( script );
IPreferences preferences = PreferenceFactory.getInstance( )
.getPreferences( ReportPlugin.getDefault( ) );
if ( preferences instanceof PreferenceWrapper )
{
IPreferenceStore store = ( (PreferenceWrapper) preferences ).getPrefsStore( );
if ( store != null )
{
IPreferenceStore baseEditorPrefs = EditorsUI.getPreferenceStore();
setPreferenceStore( new ChainedPreferenceStore(new IPreferenceStore[]{store, baseEditorPrefs}) );
}
}
}
示例10: dispose
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
public void dispose() {
if (fForegroundColor != null) {
fForegroundColor.dispose();
fForegroundColor = null;
}
if (fBackgroundColor != null) {
fBackgroundColor.dispose();
fBackgroundColor = null;
}
if (fSelectionForegroundColor != null) {
fSelectionForegroundColor.dispose();
fSelectionForegroundColor = null;
}
if (fSelectionBackgroundColor != null) {
fSelectionBackgroundColor.dispose();
fSelectionBackgroundColor = null;
}
if (fListener != null) {
final IPreferenceStore store = EditorsUI.getPreferenceStore();
if (store != null) {
store.removePropertyChangeListener(fListener);
}
}
super.dispose();
}
示例11: createClient
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
/**
* Fill the section.
*/
private void createClient(Section section, FormToolkit toolkit) {
Composite container = toolkit.createComposite(section);
section.setClient(container);
container.setLayout(new GridLayout());
MarkupLanguage language = new MarkdownLanguage();
markupViewer = new MarkupSourceViewer(container, null, SWT.WRAP | SWT.V_SCROLL, language);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
markupViewer.getControl().setLayoutData(gridData);
MarkupSourceViewerConfiguration configuration = new MarkupSourceViewerConfiguration(EditorsUI.getPreferenceStore());
Font font = JFaceResources.getTextFont();
markupViewer.getTextWidget().setFont(font);
configuration.setMarkupLanguage(language);
markupViewer.configure(configuration);
markupViewer.setEditable(true);
markupViewer.getTextWidget().setData("textViewer", markupViewer);
markupViewer.getTextWidget().setData(MarkupLanguage.class.getName(), language);
markupViewer.getTextWidget().setData(ISourceViewer.class.getName(), markupViewer);
// install common text support such as content assist
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
CommonTextSupport textSupport = new CommonTextSupport(handlerService);
textSupport.install(markupViewer, true);
getSite().setSelectionProvider(markupViewer.getSelectionProvider());
configure(markupViewer, new Document());
}
示例12: TexSourceViewerConfiguration
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
/**
* Creates a new source viewer configuration.
*
* @param te The editor that this configuration is associated to
*/
public TexSourceViewerConfiguration(TexEditor editor) {
super(EditorsUI.getPreferenceStore());
this.editor = editor;
this.colorManager = new ColorManager();
this.annotationHover = new TexAnnotationHover();
// Adds a listener for changing content assistant properties if
// these are changed in the preferences
TexlipsePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new
IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (assistant == null)
return;
String property = event.getProperty();
if (TexlipseProperties.TEX_COMPLETION.equals(property)) {
assistant.enableAutoActivation(
TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(
TexlipseProperties.TEX_COMPLETION));
} else if (TexlipseProperties.TEX_COMPLETION_DELAY.equals(property)) {
assistant.setAutoActivationDelay(
TexlipsePlugin.getDefault().getPreferenceStore().getInt(
TexlipseProperties.TEX_COMPLETION_DELAY));
}
};
});
}
示例13: ProverPreferencePage
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
public ProverPreferencePage()
{
super(GRID);
// Using somebody's else PreferenceStore is not a good idea!
// @see Bug #261 in general/bugzilla/index.html
final IPreferenceStore[] preferenceStores = new IPreferenceStore[2];
preferenceStores[0] = EditorsUI.getPreferenceStore();
preferenceStores[1] = ProverUIActivator.getDefault().getPreferenceStore();
setPreferenceStore(new TLCChainedPreferenceStore(preferenceStores));
getPreferenceStore().addPropertyChangeListener(this);
setDescription("Color Predicates");
}
示例14: getPreferenceStore
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
public IPreferenceStore getPreferenceStore() {
lazyInitialize();
Activator activator = Activator.getDefault();
if (activator != null)
return new ChainedPreferenceStore(new IPreferenceStore[] {
getWritablePreferenceStore(),
activator.getPreferenceStore(),
EditorsUI.getPreferenceStore() });
return new ChainedPreferenceStore(new IPreferenceStore[] {
getWritablePreferenceStore(),
EditorsUI.getPreferenceStore() });
}
示例15: getContextPreferenceStore
import org.eclipse.ui.editors.text.EditorsUI; //導入方法依賴的package包/類
public IPreferenceStore getContextPreferenceStore(Object context) {
lazyInitialize();
// may be null on shutdown
Activator activator = Activator.getDefault();
if (activator != null)
return new ChainedPreferenceStore(new IPreferenceStore[] {
getWritablePreferenceStore(context),
activator.getPreferenceStore(),
EditorsUI.getPreferenceStore()});
return new ChainedPreferenceStore(new IPreferenceStore[] {
getWritablePreferenceStore(context),
EditorsUI.getPreferenceStore()});
}