本文整理匯總了Java中org.eclipse.jface.text.source.SourceViewer.configure方法的典型用法代碼示例。如果您正苦於以下問題:Java SourceViewer.configure方法的具體用法?Java SourceViewer.configure怎麽用?Java SourceViewer.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.text.source.SourceViewer
的用法示例。
在下文中一共展示了SourceViewer.configure方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createSourceViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
/**
* Creates the source viewer to be used by this editor.
*
* @param parent
* the parent control
* @return the source viewer
*/
protected SourceViewer createSourceViewer( Composite parent )
{
IVerticalRuler ruler = createVerticalRuler( );
Composite composite = new Composite( parent, SWT.BORDER
| SWT.LEFT_TO_RIGHT );
composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );
composite.setLayout( UIUtil.createGridLayoutWithoutMargin( ) );
int styles = SWT.V_SCROLL
| SWT.H_SCROLL
| SWT.MULTI
| SWT.BORDER
| SWT.FULL_SELECTION;
SourceViewer viewer = new SourceViewer( composite, ruler, styles );
viewer.configure( sourceViewerConfiguration );
updateStyledTextColors( viewer.getTextWidget( ) );
JSEditorInput editorInput = new JSEditorInput( expression,
getEncoding( ) );
JSDocumentProvider documentProvider = new JSDocumentProvider( );
try
{
documentProvider.connect( editorInput );
}
catch ( CoreException e )
{
ExceptionHandler.handle( e );
}
viewer.setDocument( documentProvider.getDocument( editorInput ),
ruler == null ? null : ruler.getModel( ) );
return viewer;
}
示例2: buildEditorText
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private StyledText buildEditorText( Composite parent){
final SourceViewer sourceViewer = new SourceViewer(parent, null, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
final HConfiguration sourceConf = new HConfiguration(HContentAssistProcessor.PARAM_PROCESSOR);
sourceViewer.configure(sourceConf);
sourceViewer.setDocument(DocumentUtils.createDocument1());
sourceViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed( KeyEvent e){
// if ((e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0)) {
if (Utils.isAutoAssistInvoked(e)) {
IContentAssistant ca = sourceConf.getContentAssistant(sourceViewer);
ca.showPossibleCompletions();
}
}
});
return sourceViewer.getTextWidget();
}
示例3: createViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
protected SourceViewer createViewer(Composite parent) {
IDocument document= new Document();
JavaScriptTextTools tools= JSDTTypeScriptUIPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JSDTTypeScriptUIPlugin.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, IJavaScriptPartitions.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 TypeScriptSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
return viewer;
}
示例4: configureTextViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
@Override
protected void configureTextViewer(TextViewer viewer) {
if (viewer instanceof SourceViewer) {
SourceViewer sourceViewer = (SourceViewer) viewer;
if (fSourceViewer == null)
fSourceViewer = new ArrayList<>();
if (!fSourceViewer.contains(sourceViewer))
fSourceViewer.add(sourceViewer);
TypeScriptTextTools tools = JSDTTypeScriptUIPlugin.getDefault().getJavaTextTools();
if (tools != null) {
IEditorInput editorInput = getEditorInput(sourceViewer);
sourceViewer.unconfigure();
if (editorInput == null) {
sourceViewer.configure(getSourceViewerConfiguration(sourceViewer, null));
return;
}
getSourceViewerConfiguration(sourceViewer, editorInput);
}
}
}
示例5: createViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
/**
* Creates the viewer to be used to display the pattern. Subclasses may override.
*
* @param parent the parent composite of the viewer
* @return a configured <code>SourceViewer</code>
*/
protected SourceViewer createViewer(Composite parent) {
SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
SourceViewerConfiguration configuration= new SourceViewerConfiguration() {
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant= new ContentAssistant();
assistant.enableAutoActivation(true);
assistant.enableAutoInsert(true);
assistant.setContentAssistProcessor(fTemplateProcessor, IDocument.DEFAULT_CONTENT_TYPE);
return assistant;
}
};
viewer.configure(configuration);
return viewer;
}
示例6: configureSourceViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
protected void configureSourceViewer(SourceViewer sourceViewer) {
IEditorInput editorInput = getEditorInput(sourceViewer);
SourceViewerConfiguration sourceViewerConfiguration = createSourceViewerConfiguration(sourceViewer, editorInput);
sourceViewer.unconfigure();
sourceViewer.configure(sourceViewerConfiguration);
if (sourceViewer.getDocument() instanceof IXtextDocument) {
IXtextDocument xtextDocument = (IXtextDocument) sourceViewer.getDocument();
if (!xtextDocument.readOnly(TEST_EXISTING_XTEXT_RESOURCE)) {
String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer);
for (String contentType : configuredContentTypes) {
sourceViewer.removeTextHovers(contentType);
}
sourceViewer.setHyperlinkDetectors(null, sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer));
}
}
}
示例7: createViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的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;
}
示例8: JavaTextViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的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);
}
示例9: configureTextViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的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);
}
}
}
示例10: createPreviewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private Control createPreviewer(Composite parent) {
IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { fOverlayStore,
EditorConfigUIPlugin.getDefault().getCombinedPreferenceStore() });
fPreviewViewer = new SourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
fColorManager = new EditorConfigColorManager(false);
EditorConfigSourceViewerConfiguration configuration = new EditorConfigSourceViewerConfiguration(fColorManager,
store, null, IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING);
fPreviewViewer.configure(configuration);
Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_CONFIG_EDITOR_TEXT_FONT);
fPreviewViewer.getTextWidget().setFont(font);
new SourcePreviewerUpdater(fPreviewViewer, configuration, store);
fPreviewViewer.setEditable(false);
String content = loadPreviewContentFromFile("EditorConfigEditorColorSettingPreviewCode.txt"); //$NON-NLS-1$
IDocument document = new Document(content);
EditorConfigDocumentSetupParticipant.setupDocument(document);
fPreviewViewer.setDocument(document);
return fPreviewViewer.getControl();
}
示例11: createViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
/**
* Creates, configures and returns a source viewer to present the template
* pattern on the preference page. Clients may override to provide a
* custom source viewer featuring e.g. syntax coloring.
*
* @param parent
* the parent control
* @return a configured source viewer
*/
@Override
protected final SourceViewer createViewer(Composite parent) {
final ApexSourceViewerConfiguration configuration = new ApexSourceViewerConfiguration(preferenceStore(), null);
configuration.init(this.componentModel.getProject());
final IDocument document = new Document();
new ApexDocumentSetupParticipant().setup(document);
SourceViewer viewer= new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
viewer.configure(configuration);
viewer.setDocument(document);
viewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
viewer.setEditable(false);
return viewer;
}
示例12: createViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
@Override
protected SourceViewer createViewer(Composite parent) {
final SourceViewer viewer = super.createViewer(parent);
new ApexDocumentSetupParticipant().setup(viewer.getDocument());
final ApexSourceViewerConfiguration configuration = new ApexSourceViewerConfiguration(preferenceStore(), null);
configuration.init(null);
viewer.unconfigure();
viewer.configure(configuration);
viewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
viewer.setEditable(false);
return viewer;
}
示例13: PyContentViewer
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
PyContentViewer(Composite parent, CompareConfiguration mp) {
fSourceViewer = new SourceViewer(parent, null, SWT.LEFT_TO_RIGHT | SWT.H_SCROLL | SWT.V_SCROLL);
IPreferenceStore store = PydevPrefs.getChainedPrefStore();
final ColorAndStyleCache c = new ColorAndStyleCache(store);
// Ideally we wouldn't pass null for the grammarVersionProvider... although
// I haven't been able to get to this code at all (is this something still needed?)
// It seems that Eclipse (in 4.5m5 at least) never gets to use the org.eclipse.compare.contentViewers
// as it seems to use what's provided by org.eclipse.compare.contentMergeViewers or the
// editor directly... if that's not the case, first we need to discover how that's still needed.
fSourceViewer.configure(new PyEditConfigurationWithoutEditor(c, store, null));
fSourceViewer.setEditable(false);
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
c.dispose();
}
});
}
示例14: buildEditorText
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private StyledText buildEditorText( Composite parent){
final SourceViewer sourceViewer = new SourceViewer(parent, null, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
final XMLConfiguration sourceConf = new XMLConfiguration(new ColorManagerAdaptor(ResourceUtils.getResourceCache()));
sourceViewer.configure(sourceConf);
sourceViewer.setDocument(DocumentUtils.createDocument2());
return sourceViewer.getTextWidget();
}
示例15: buildEditorText
import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private static StyledText buildEditorText( Composite parent){
final SourceViewer sourceViewer = new SourceViewer(parent, null, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
final XMLConfiguration sourceConf = new XMLConfiguration(new ColorManagerAdaptor(ResourceUtils.getResourceCache()));
sourceViewer.configure(sourceConf);
sourceViewer.setDocument(DocumentUtils.createDocument2());
return sourceViewer.getTextWidget();
}