当前位置: 首页>>代码示例>>Java>>正文


Java JavaSourceViewerConfiguration类代码示例

本文整理汇总了Java中org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration的典型用法代码示例。如果您正苦于以下问题:Java JavaSourceViewerConfiguration类的具体用法?Java JavaSourceViewerConfiguration怎么用?Java JavaSourceViewerConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JavaSourceViewerConfiguration类属于org.eclipse.jdt.ui.text包,在下文中一共展示了JavaSourceViewerConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSignaturePreview

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
/**
 * Creates a signature preview viewer in a parent composite with a 1-column GridLayout.
 * 
 * @param parent the parent 
 * @return the preview viewer
 * @since 3.9
 */
public static JavaSourceViewer createSignaturePreview(Composite parent) {
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	JavaSourceViewer signaturePreview= new JavaSourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP, store);
	signaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	StyledText textWidget= signaturePreview.getTextWidget();
	textWidget.setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	textWidget.setAlwaysShowScrollBars(false);
	signaturePreview.adaptBackgroundColor(parent);
	signaturePreview.setDocument(new Document());
	signaturePreview.setEditable(false);

	GridData gdata= new GridData(GridData.FILL_BOTH);
	gdata.widthHint= new PixelConverter(textWidget).convertWidthInCharsToPixels(50);
	gdata.heightHint= textWidget.getLineHeight() * 2;
	textWidget.setLayoutData(gdata);
	
	return signaturePreview;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:InputPageUtil.java

示例2: setPreferenceStore

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:JavaEditor.java

示例3: JavaTextViewer

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的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);

}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:JavaTextViewer.java

示例4: createSignaturePreview

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void createSignaturePreview(Composite composite, RowLayouter layouter) {
	Label previewLabel= new Label(composite, SWT.NONE);
	previewLabel.setText(RefactoringMessages.ExtractMethodInputPage_signature_preview);
	layouter.perform(previewLabel);

	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	fSignaturePreview= new JavaSourceViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/, store);
	fSignaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	fSignaturePreview.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	fSignaturePreview.adaptBackgroundColor(composite);
	fSignaturePreview.setDocument(fSignaturePreviewDocument);
	fSignaturePreview.setEditable(false);

	//Layouting problems with wrapped text: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=9866
	Control signaturePreviewControl= fSignaturePreview.getControl();
	PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl);
	GridData gdata= new GridData(GridData.FILL_BOTH);
	gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50);
	gdata.heightHint= pixelConverter.convertHeightInCharsToPixels(2);
	signaturePreviewControl.setLayoutData(gdata);
	layouter.perform(signaturePreviewControl);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:23,代码来源:ExtractMethodInputPage.java

示例5: createMethodSignature

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void createMethodSignature(Composite parent) {
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	JavaSourceViewer signatureViewer= new JavaSourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.WRAP /*| SWT.BORDER*/, store);
	signatureViewer.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	signatureViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	signatureViewer.adaptBackgroundColor(parent);
	String signatureLabel= JavaElementLabels.getElementLabel(fRefactoring.getMethod(), LABEL_FLAGS);
	signatureViewer.setDocument(new Document(signatureLabel));
	signatureViewer.setEditable(false);

	Control signatureControl= signatureViewer.getControl();
	PixelConverter pixelConverter= new PixelConverter(signatureControl);
	GridData gdata= new GridData(GridData.FILL_HORIZONTAL);
	gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50);
	signatureControl.setLayoutData(gdata);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:ReplaceInvocationsInputPage.java

示例6: createSignaturePreview

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void createSignaturePreview(Composite composite) {
	Label previewLabel= new Label(composite, SWT.NONE);
	previewLabel.setText(RefactoringMessages.ChangeSignatureInputPage_method_Signature_Preview);

	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	fSignaturePreview= new JavaSourceViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/, store);
	fSignaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	fSignaturePreview.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	fSignaturePreview.adaptBackgroundColor(composite);
	fSignaturePreview.setDocument(fSignaturePreviewDocument);
	fSignaturePreview.setEditable(false);

	//Layouting problems with wrapped text: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=9866
	Control signaturePreviewControl= fSignaturePreview.getControl();
	PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl);
	GridData gdata= new GridData(GridData.FILL_BOTH);
	gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50);
	gdata.heightHint= pixelConverter.convertHeightInCharsToPixels(2);
	signaturePreviewControl.setLayoutData(gdata);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:IntroduceParameterWizard.java

示例7: createControl

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
  composite = new Composite(parent, SWT.NONE);
  composite.setLayout(new GridLayout(1, false));

  generateJUnitTimeoutEditor = new Button(composite, SWT.CHECK | SWT.LEFT);
  generateJUnitTimeoutEditor.setText("Use timeouts in generated test cases");
  generateJUnitTimeoutEditor.setSelection(EclipseForcesPlugin.getDefault()
      .isGenerateJUnitTimeout());

  codeTemplateLabel = new Label(composite, SWT.NONE);
  codeTemplateLabel.setText("Code template:");

  codeTemplateEditor = new SourceViewer(composite, null, SWT.MULTI | SWT.H_SCROLL
      | SWT.V_SCROLL | SWT.BORDER);
  JavaSourceViewerConfiguration config = new JavaSourceViewerConfiguration(JavaUI.getColorManager(), JavaPlugin.getDefault().getCombinedPreferenceStore(), null, IJavaPartitions.JAVA_PARTITIONING);
  codeTemplateEditor.configure(config);
  Document doc = new Document(EclipseForcesPlugin.getDefault().getCodeTemplate());
  JavaPartitionScanner scanner = new JavaPartitionScanner();
  FastPartitioner fp = new FastPartitioner(scanner, new String[] {IJavaPartitions.JAVA_STRING, IJavaPartitions.JAVA_MULTI_LINE_COMMENT, IJavaPartitions.JAVA_CHARACTER,
      IJavaPartitions.JAVA_DOC, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT});
  fp.connect(doc);
  doc.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, fp);
  codeTemplateEditor.setDocument(doc);
  codeTemplateEditor.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
  codeTemplateEditor.getControl().pack();
}
 
开发者ID:fmoraes74,项目名称:eclipseforces,代码行数:28,代码来源:JavaPreferencesPage.java

示例8: createSourceViewer

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void createSourceViewer(Composite c) {
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	fSourceViewer= new JavaSourceViewer(c, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, store);
	fSourceViewer.configure(new JavaSourceViewerConfiguration(getJavaTextTools().getColorManager(), store, null, null));
	fSourceViewer.setEditable(false);
	fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
	fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	Document document= new Document();
	getJavaTextTools().setupJavaDocumentPartitioner(document);
	fSourceViewer.setDocument(document);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:RenameTypeWizardSimilarElementsPage.java

示例9: createSourceViewer

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的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);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:ExternalizeWizardPage.java

示例10: createControl

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
@Override
public void createControl(Composite parent) {
	super.createControl(parent);
	final SourceViewer viewer= getSourceViewer();
	viewer.unconfigure();
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	viewer.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	viewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:JavaStatusContextViewer.java

示例11: createSourceViewer

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void createSourceViewer(final Composite c) {
	final IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	fSourceViewer= new JavaSourceViewer(c, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION, store);
	fSourceViewer.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	fSourceViewer.setEditable(false);
	fSourceViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
	fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:PullUpMethodPage.java

示例12: handlePropertyChange

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void handlePropertyChange(PropertyChangeEvent event) {
	if (fSourceViewerConfiguration != null) {
		for (Iterator<Entry<SourceViewer, JavaSourceViewerConfiguration>> iterator= fSourceViewerConfiguration.entrySet().iterator(); iterator.hasNext();) {
			Entry<SourceViewer, JavaSourceViewerConfiguration> entry= iterator.next();
			JavaSourceViewerConfiguration configuration= entry.getValue();
			if (configuration.affectsTextPresentation(event)) {
				configuration.handlePropertyChangeEvent(event);
				ITextViewer viewer= entry.getKey();
				viewer.invalidateTextPresentation();
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:JavaMergeViewer.java

示例13: initializeEditor

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的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);
    
    
}
 
开发者ID:kopl,项目名称:SPLevo,代码行数:14,代码来源:UnifiedDiffEditor.java

示例14: createSignaturePreview

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
private void createSignaturePreview(Composite composite) {
			Label previewLabel= new Label(composite, SWT.NONE);
			previewLabel.setText(RefactoringMessages.ChangeSignatureInputPage_method_Signature_Preview);

//			//XXX: use ViewForm to draw a flat border. Beware of common problems with wrapping layouts
//			//inside GridLayout. GridData must be constrained to force wrapping. See bug 9866 et al.
//			ViewForm border= new ViewForm(composite, SWT.BORDER | SWT.FLAT);

			IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
			fSignaturePreview= new JavaSourceViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/, store);
			fSignaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
			fSignaturePreview.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
			fSignaturePreview.adaptBackgroundColor(composite);
			fSignaturePreview.setDocument(fSignaturePreviewDocument);
			fSignaturePreview.setEditable(false);

			//Layouting problems with wrapped text: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=9866
			Control signaturePreviewControl= fSignaturePreview.getControl();
			PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl);
			GridData gdata= new GridData(GridData.FILL_BOTH);
			gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50);
			gdata.heightHint= pixelConverter.convertHeightInCharsToPixels(2);
			signaturePreviewControl.setLayoutData(gdata);

//			//XXX must force JavaSourceViewer text widget to wrap:
//			border.setContent(signaturePreviewControl);
//			GridData borderData= new GridData(GridData.FILL_BOTH);
//			borderData.widthHint= gdata.widthHint;
//			borderData.heightHint= gdata.heightHint;
//			border.setLayoutData(borderData);
		}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:32,代码来源:ChangeSignatureWizard.java

示例15: createJavaSourceViewerConfiguration

import org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration; //导入依赖的package包/类
@Override
protected JavaSourceViewerConfiguration createJavaSourceViewerConfiguration() {
  JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools();
  return new GWTSourceViewerConfiguration(textTools.getColorManager(),
      getPreferenceStore(), this);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:7,代码来源:GWTJavaEditor.java


注:本文中的org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。