本文整理汇总了Java中org.eclipse.jdt.ui.text.JavaTextTools类的典型用法代码示例。如果您正苦于以下问题:Java JavaTextTools类的具体用法?Java JavaTextTools怎么用?Java JavaTextTools使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaTextTools类属于org.eclipse.jdt.ui.text包,在下文中一共展示了JavaTextTools类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeEditor
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的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);
}
示例2: createPatternViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
protected SourceViewer createPatternViewer(Composite parent) {
IDocument document= new Document();
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
JavaSourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store);
SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new JavaSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
viewer.setEditable(false);
return viewer;
}
示例3: setPreferenceStore
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
protected void setPreferenceStore(IPreferenceStore store) {
super.setPreferenceStore(store);
SourceViewerConfiguration sourceViewerConfiguration= getSourceViewerConfiguration();
if (sourceViewerConfiguration == null || sourceViewerConfiguration instanceof JavaSourceViewerConfiguration) {
JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
setSourceViewerConfiguration(new JavaSourceViewerConfiguration(textTools.getColorManager(), store, this, IJavaPartitions.JAVA_PARTITIONING));
}
if (getSourceViewer() instanceof JavaSourceViewer)
((JavaSourceViewer)getSourceViewer()).setPreferenceStore(store);
fMarkOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_MARK_OCCURRENCES);
fStickyOccurrenceAnnotations= store.getBoolean(PreferenceConstants.EDITOR_STICKY_OCCURRENCES);
fMarkTypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_TYPE_OCCURRENCES);
fMarkMethodOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_OCCURRENCES);
fMarkConstantOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_CONSTANT_OCCURRENCES);
fMarkFieldOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_FIELD_OCCURRENCES);
fMarkLocalVariableypeOccurrences= store.getBoolean(PreferenceConstants.EDITOR_MARK_LOCAL_VARIABLE_OCCURRENCES);
fMarkExceptions= store.getBoolean(PreferenceConstants.EDITOR_MARK_EXCEPTION_OCCURRENCES);
fMarkImplementors= store.getBoolean(PreferenceConstants.EDITOR_MARK_IMPLEMENTORS);
fMarkMethodExitPoints= store.getBoolean(PreferenceConstants.EDITOR_MARK_METHOD_EXIT_POINTS);
fMarkBreakContinueTargets= store.getBoolean(PreferenceConstants.EDITOR_MARK_BREAK_CONTINUE_TARGETS);
}
示例4: createViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
protected SourceViewer createViewer(Composite parent) {
IDocument document= new Document();
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false);
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new JavaSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
return viewer;
}
示例5: initialize
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
private void initialize() {
initializeFields();
for (int i= 0, n= fSyntaxColorListModel.length; i < n; i++)
fHighlightingColorList.add(new HighlightingColorListItem (fSyntaxColorListModel[i][0], fSyntaxColorListModel[i][1], fSyntaxColorListModel[i][1] + BOLD, fSyntaxColorListModel[i][1] + ITALIC, fSyntaxColorListModel[i][1] + STRIKETHROUGH, fSyntaxColorListModel[i][1] + UNDERLINE, null));
fHighlightingColorListViewer.setInput(fHighlightingColorList);
fHighlightingColorListViewer.setSelection(new StructuredSelection(fHighlightingColorListViewer.getElementAt(0)));
// Make sure we propagate the colors to the shared color manager
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
PropertiesFileSourceViewerConfiguration sharedPropertiesFileSourceViewerConfiguration= new PropertiesFileSourceViewerConfiguration(textTools.getColorManager(), store, null, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING);
new SourcePreviewerUpdater(fPreviewViewer, sharedPropertiesFileSourceViewerConfiguration, store);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:PropertiesFileEditorPreferencePage.java
示例6: JavaTextViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
JavaTextViewer(Composite parent) {
fSourceViewer= new SourceViewer(parent, null, SWT.LEFT_TO_RIGHT | SWT.H_SCROLL | SWT.V_SCROLL);
JavaTextTools tools= JavaCompareUtilities.getJavaTextTools();
if (tools != null) {
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
fSourceViewer.configure(new JavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING));
}
fSourceViewer.setEditable(false);
String symbolicFontName= JavaMergeViewer.class.getName();
Font font= JFaceResources.getFont(symbolicFontName);
if (font != null)
fSourceViewer.getTextWidget().setFont(font);
}
示例7: configureTextViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
protected void configureTextViewer(TextViewer viewer) {
if (viewer instanceof SourceViewer) {
SourceViewer sourceViewer= (SourceViewer)viewer;
if (fSourceViewer == null)
fSourceViewer= new ArrayList<SourceViewer>();
if (!fSourceViewer.contains(sourceViewer))
fSourceViewer.add(sourceViewer);
JavaTextTools tools= JavaCompareUtilities.getJavaTextTools();
if (tools != null) {
IEditorInput editorInput= getEditorInput(sourceViewer);
sourceViewer.unconfigure();
if (editorInput == null) {
sourceViewer.configure(getSourceViewerConfiguration(sourceViewer, null));
return;
}
getSourceViewerConfiguration(sourceViewer, editorInput);
}
}
}
示例8: createSourceViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
private void createSourceViewer(Composite parent) {
Composite c= new Composite(parent, SWT.NONE);
c.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout gl= new GridLayout();
gl.marginHeight= 0;
gl.marginWidth= 0;
c.setLayout(gl);
Label l= new Label(c, SWT.NONE);
l.setText(NLSUIMessages.ExternalizeWizardPage_context);
l.setLayoutData(new GridData());
// source viewer
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
int styles= SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION;
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
fSourceViewer= new JavaSourceViewer(c, null, null, false, styles, store);
fSourceViewer.configure(new JavaSourceViewerConfiguration(tools.getColorManager(), store, null, null));
fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
try {
String contents= fCu.getBuffer().getContents();
IDocument document= new Document(contents);
tools.setupJavaDocumentPartitioner(document);
fSourceViewer.setDocument(document);
fSourceViewer.setEditable(false);
GridData gd= new GridData(GridData.FILL_BOTH);
gd.heightHint= convertHeightInCharsToPixels(10);
gd.widthHint= convertWidthInCharsToPixels(40);
fSourceViewer.getControl().setLayoutData(gd);
} catch (JavaModelException e) {
ExceptionHandler.handle(e, NLSUIMessages.ExternalizeWizardPage_exception_title, NLSUIMessages.ExternalizeWizardPage_exception_message);
}
}
示例9: createDocument
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
protected IDocument createDocument(Object element) throws CoreException {
IDocument document= super.createDocument(element);
if (document != null) {
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
}
return document;
}
示例10: JavaPreview
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
public JavaPreview(Map<String, String> workingValues, Composite parent) {
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
fPreviewDocument= new Document();
fWorkingValues= workingValues;
tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING);
PreferenceStore prioritizedSettings= new PreferenceStore();
HashMap<String, String> complianceOptions= new HashMap<String, String>();
JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST);
for (Entry<String, String> complianceOption : complianceOptions.entrySet()) {
prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue());
}
IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() };
fPreferenceStore= new ChainedPreferenceStore(chain);
fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
fSourceViewer.setEditable(false);
Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
fSourceViewer.getTextWidget().setCursor(arrowCursor);
// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
// fSourceViewer.getTextWidget().setCaret(null);
fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true);
fSourceViewer.configure(fViewerConfiguration);
fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
fMarginPainter= new MarginPainter(fSourceViewer);
final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
fSourceViewer.addPainter(fMarginPainter);
new JavaSourcePreviewerUpdater();
fSourceViewer.setDocument(fPreviewDocument);
}
示例11: getContentAssistant
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
JavaTextTools textTools= JavaPlugin.getDefault().getJavaTextTools();
IColorManager manager= textTools.getColorManager();
ContentAssistant assistant= new ContentAssistant();
assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
// Register the same processor for strings and single line comments to get code completion at the start of those partitions.
assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_STRING);
assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_CHARACTER);
assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_DOC);
assistant.enableAutoInsert(store.getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT));
assistant.enableAutoActivation(store.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION));
assistant.setAutoActivationDelay(store.getInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
assistant.setInformationControlCreator(new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell parent) {
return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString());
}
});
Color background= getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, manager);
assistant.setContextInformationPopupBackground(background);
assistant.setContextSelectorBackground(background);
Color foreground= getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, manager);
assistant.setContextInformationPopupForeground(foreground);
assistant.setContextSelectorForeground(foreground);
return assistant;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:CodeTemplateSourceViewerConfiguration.java
示例12: createViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
private SourceViewer createViewer(Composite parent, int nColumns) {
Label label= new Label(parent, SWT.NONE);
label.setText(PreferencesMessages.CodeTemplateBlock_preview);
GridData data= new GridData();
data.horizontalSpan= nColumns;
label.setLayoutData(data);
IDocument document= new Document();
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
CodeTemplateSourceViewerConfiguration configuration= new CodeTemplateSourceViewerConfiguration(tools.getColorManager(), store, null, fTemplateProcessor);
viewer.configure(configuration);
viewer.setEditable(false);
Cursor arrowCursor= viewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
viewer.getTextWidget().setCursor(arrowCursor);
// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
// viewer.getTextWidget().setCaret(null);
viewer.setDocument(document);
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new JavaSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
data.horizontalSpan= nColumns;
data.heightHint= fPixelConverter.convertHeightInCharsToPixels(5);
control.setLayoutData(data);
return viewer;
}
示例13: PropertiesFileViewer
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
PropertiesFileViewer(Composite parent) {
fSourceViewer= new SourceViewer(parent, null, SWT.LEFT_TO_RIGHT | SWT.H_SCROLL | SWT.V_SCROLL);
JavaTextTools tools= JavaCompareUtilities.getJavaTextTools();
if (tools != null) {
IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
fSourceViewer.configure(new PropertiesFileSourceViewerConfiguration(tools.getColorManager(), store, null, IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING));
}
fSourceViewer.setEditable(false);
String symbolicFontName= PropertiesFileMergeViewer.class.getName();
Font font= JFaceResources.getFont(symbolicFontName);
if (font != null)
fSourceViewer.getTextWidget().setFont(font);
}
示例14: initializeEditor
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
@Override
protected void initializeEditor() {
super.initializeEditor();
// install java source viewer configuration to allow java syntax highlighting
JavaTextTools javaTextTools = JavaPlugin.getDefault().getJavaTextTools();
JavaSourceViewerConfiguration sourceViewerConfiguration = new JavaSourceViewerConfiguration(
javaTextTools.getColorManager(), JavaPlugin.getDefault().getCombinedPreferenceStore(), this,
IJavaPartitions.JAVA_PARTITIONING);
setSourceViewerConfiguration(sourceViewerConfiguration);
}
示例15: installViewerConfiguration
import org.eclipse.jdt.ui.text.JavaTextTools; //导入依赖的package包/类
private void installViewerConfiguration() {
JavaTextTools tools = JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(getDocument(), IJavaPartitions.JAVA_PARTITIONING);
IPreferenceStore store = JavaPlugin.getDefault().getCombinedPreferenceStore();
configure(new HydrographJavaSourceViewerConfiguration((IColorManager) sharedColors, store, this));
}