本文整理匯總了Java中org.eclipse.ui.editors.text.EditorsUI類的典型用法代碼示例。如果您正苦於以下問題:Java EditorsUI類的具體用法?Java EditorsUI怎麽用?Java EditorsUI使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EditorsUI類屬於org.eclipse.ui.editors.text包,在下文中一共展示了EditorsUI類的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: doCreateInformationControl
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
@Override
public IInformationControl doCreateInformationControl(Shell parent) {
String tooltipAffordanceString = EditorsUI
.getTooltipAffordanceString();
if (BrowserInformationControl.isAvailable(parent)) {
String font = "org.eclipse.jdt.ui.javadocfont";
BrowserInformationControl iControl = new BrowserInformationControl(
parent, font, false) {
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
return fInformationPresenterControlCreator;
}
};
addLinkListener(iControl);
return iControl;
} else {
return new DefaultInformationControl(parent,
tooltipAffordanceString);
}
}
示例5: getEditorId
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
private String getEditorId(IFileStore file) {
// IWorkbench workbench= fWindow.getWorkbench();
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorRegistry editorRegistry= workbench.getEditorRegistry();
IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));
// check the OS for in-place editor (OLE on Win32)
if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
// check the OS for external editor
if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
if (descriptor != null)
return descriptor.getId();
return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
示例6: getEditorId
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
private String getEditorId(IFileStore file) {
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorRegistry editorRegistry= workbench.getEditorRegistry();
IEditorDescriptor descriptor= editorRegistry.getDefaultEditor(file.getName(), getContentType(file));
// check the OS for in-place editor (OLE on Win32)
if (descriptor == null && editorRegistry.isSystemInPlaceEditorAvailable(file.getName()))
descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID);
// check the OS for external editor
if (descriptor == null && editorRegistry.isSystemExternalEditorAvailable(file.getName()))
descriptor= editorRegistry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
if (descriptor != null)
return descriptor.getId();
return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
示例7: initializeDefaultPreferences
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = PreferenceConstants.getPreferenceStore();
EditorsUI.useAnnotationsPreferencePage(store);
EditorsUI.useQuickDiffPreferencePage(store);
PreferenceConstants.initializeDefaultValues();
// Override HTML Editor content assist sort to set at first the HTML
// Angular proposal in the completion.
IPreferenceStore htmlStore = HTMLUIPlugin.getDefault().getPreferenceStore();
String htmlContentAssistSort = htmlStore
.getDefaultString(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER);
if (htmlContentAssistSort != null
&& !htmlContentAssistSort.contains("ts.eclipse.ide.angular.ui.proposalCategory.htmlTags\0")) {
htmlStore.setDefault(HTMLUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER,
"ts.eclipse.ide.angular.ui.proposalCategory.htmlTags\0" + htmlContentAssistSort);
}
}
示例8: configurePreferenceKeys
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
private void configurePreferenceKeys() {
preferenceKeysForEnablement = new HashSet<>();
preferenceKeysForActivation = new HashSet<>();
// Global settings (master switch)
preferenceKeysForEnablement
.add(AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED);
preferenceKeysForActivation
.add(AbstractTextEditor.PREFERENCE_HYPERLINK_KEY_MODIFIER);
// All applicable individual hyperlink detectors settings.
Map targets = configuration.getHyperlinkDetectorTargets(this);
for (HyperlinkDetectorDescriptor desc : EditorsUI
.getHyperlinkDetectorRegistry()
.getHyperlinkDetectorDescriptors()) {
if (targets.keySet().contains(desc.getTargetId())) {
preferenceKeysForEnablement.add(desc.getId());
preferenceKeysForActivation.add(desc.getId()
+ HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX);
}
}
}
示例9: initializeDefaultPreferences
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
public void initializeDefaultPreferences() {
IPreferenceStore store = JuliaEditorPlugin.getDefault().getPreferenceStore();
EditorsUI.useAnnotationsPreferencePage(store);
EditorsUI.useQuickDiffPreferencePage(store);
PreferenceConstants.initializeDefaultValues(store);
PreferenceConverter.setDefault(store, JuliaColourConstants.COMMENT, COMMENT_COLOUR);
PreferenceConverter.setDefault(store, JuliaColourConstants.KEYWORD, KEYWORD_COLOUR);
PreferenceConverter.setDefault(store, JuliaColourConstants.STRING, STRING_COLOUR);
store.setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
store
.setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
store.setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
store
.setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);
store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4);
store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);
store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB);
store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "4");
}
示例10: 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);
}
示例11: doCreateInformationControl
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
@Override
public IInformationControl doCreateInformationControl(final Shell parent) {
final String tooltipAffordanceString = EditorsUI.getTooltipAffordanceString();
if (BrowserInformationControl.isAvailable(parent)) {
final String font = "org.eclipse.jdt.ui.javadocfont"; // FIXME:
// PreferenceConstants.APPEARANCE_JAVADOC_FONT;
final IXtextBrowserInformationControl iControl =
new GamlInformationControl(parent, font, tooltipAffordanceString) {
};
addLinkListener(iControl);
return iControl;
} else {
return new DefaultInformationControl(parent, tooltipAffordanceString);
}
}
示例12: 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;
}
示例13: doCreateInformationControl
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
public IInformationControl doCreateInformationControl(Shell parent)
{
if (CustomBrowserInformationControl.isAvailable(parent))
{
CustomBrowserInformationControl iControl = new CustomBrowserInformationControl(parent, null,
EditorsUI.getTooltipAffordanceString())
{
public IInformationControlCreator getInformationPresenterControlCreator()
{
return informationPresenterControlCreator;
}
};
iControl.setBackgroundColor(getBackgroundColor());
iControl.setForegroundColor(getForegroundColor());
return iControl;
}
else
{
// return new ThemedInformationControl(parent, null, EditorsUI.getTooltipAffordanceString());
return new DefaultInformationControl(parent, true);
}
}
示例14: initializeEditor
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
@Override
protected void initializeEditor() {
setDocumentProvider(JavaPlugin.getDefault().getPropertiesFileDocumentProvider());
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
setPreferenceStore(store);
JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
setSourceViewerConfiguration(new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, this, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING));
setEditorContextMenuId("#TextEditorContext"); //$NON-NLS-1$
setRulerContextMenuId("#TextRulerContext"); //$NON-NLS-1$
setHelpContextId(ITextEditorHelpContextIds.TEXT_EDITOR);
configureInsertMode(SMART_INSERT, false);
setInsertMode(INSERT);
// Need to listen on Editors UI preference store because JDT disables this functionality in its preferences.
fPropertyChangeListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS.equals(event.getProperty()))
handlePreferenceStoreChanged(event);
}
};
EditorsUI.getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
}
示例15: getReconciler
import org.eclipse.ui.editors.text.EditorsUI; //導入依賴的package包/類
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (!EditorsUI.getPreferenceStore().getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
return null;
IReconcilingStrategy strategy= new SpellingReconcileStrategy(sourceViewer, EditorsUI.getSpellingService()) {
@Override
protected IContentType getContentType() {
return PROPERTIES_CONTENT_TYPE;
}
};
MonoReconciler reconciler= new MonoReconciler(strategy, false);
reconciler.setDelay(500);
return reconciler;
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:17,代碼來源:PropertiesFileSourceViewerConfiguration.java