當前位置: 首頁>>代碼示例>>Java>>正文


Java SourceViewer.getControl方法代碼示例

本文整理匯總了Java中org.eclipse.jface.text.source.SourceViewer.getControl方法的典型用法代碼示例。如果您正苦於以下問題:Java SourceViewer.getControl方法的具體用法?Java SourceViewer.getControl怎麽用?Java SourceViewer.getControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.text.source.SourceViewer的用法示例。


在下文中一共展示了SourceViewer.getControl方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:22,代碼來源:TypeScriptTemplatePreferencePage.java

示例2: doCreateViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private SourceViewer doCreateViewer(Composite parent) {
		Label label= new Label(parent, SWT.NONE);
		label.setText(TemplatesMessages.TemplatePreferencePage_preview);
		GridData data= new GridData();
		data.horizontalSpan= 2;
		label.setLayoutData(data);

		SourceViewer viewer= createViewer(parent);

		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);

		Control control= viewer.getControl();
		data= new GridData(GridData.FILL_BOTH);
		data.horizontalSpan= 2;
		data.heightHint= convertHeightInCharsToPixels(5);
		control.setLayoutData(data);

		return viewer;
	}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:25,代碼來源:E4TemplatePreferencePage.java

示例3: 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;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:23,代碼來源:JavaTemplatePreferencePage.java

示例4: 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();
	}
 
開發者ID:ncjones,項目名稱:editorconfig-eclipse,代碼行數:22,代碼來源:SyntaxColoringPreferencePage.java

示例5: doCreateViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private SourceViewer doCreateViewer(Composite parent) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(NewWizardMessages.WizardPage_4);
    GridData data = new GridData();
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    SourceViewer viewer = createViewer(parent);
    viewer.setEditable(false);

    Control control = viewer.getControl();
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.heightHint = convertHeightInCharsToPixels(5);
    // [261274] - source viewer was growing to fit the max line width of the template
    data.widthHint = convertWidthInCharsToPixels(2);
    control.setLayoutData(data);

    return viewer;
}
 
開發者ID:forcedotcom,項目名稱:idecore,代碼行數:21,代碼來源:AbstractTemplateSelectionPage.java

示例6: doCreateViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private SourceViewer doCreateViewer(Composite parent) {
	Label label = new Label(parent, SWT.NONE);
	label.setText("Preview");
	GridData data = new GridData();
	data.horizontalSpan = 2;
	label.setLayoutData(data);

	SourceViewer viewer = createViewer(parent);
	viewer.setEditable(false);

	Control control = viewer.getControl();
	data = new GridData(GridData.FILL_BOTH);
	data.horizontalSpan = 1;
	data.verticalSpan=2;
	data.heightHint = convertHeightInCharsToPixels(5);
	// [261274] - source viewer was growing to fit the max line width of the template
	data.widthHint = convertWidthInCharsToPixels(2);
	control.setLayoutData(data);
	
	fImage=new Label(parent, SWT.NONE);
	fImage.setLayoutData(data);

	return viewer;
}
 
開發者ID:eteration,項目名稱:glassmaker,代碼行數:25,代碼來源:NewCardTemplatesWizardPage.java

示例7: doCreateViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private SourceViewer doCreateViewer(Composite parent) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(HTMLUIMessages.NewHTMLTemplatesWizardPage_5);
    GridData data = new GridData();
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    SourceViewer viewer = createViewer(parent);
    viewer.setEditable(false);

    Control control = viewer.getControl();
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    data.heightHint = convertHeightInCharsToPixels(5);
    // [261274] - source viewer was growing to fit the max line width of the template
    data.widthHint = convertWidthInCharsToPixels(2);
    control.setLayoutData(data);

    return viewer;
}
 
開發者ID:UndefinedOffset,項目名稱:eclipse-silverstripedt,代碼行數:21,代碼來源:NewSilverStripeTemplatesWizardPage.java

示例8: doCreateViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private SourceViewer doCreateViewer(Composite parent) {
	Label label = new Label(parent, SWT.NONE);
	label.setText(Messages.NewGenericFileTemplatesWizardPage_2);
	GridData data = new GridData();
	data.horizontalSpan = 2;
	label.setLayoutData(data);

	SourceViewer viewer = createViewer(parent);
	viewer.setEditable(false);

	Control control = viewer.getControl();
	data = new GridData(GridData.FILL_BOTH);
	data.horizontalSpan = 2;
	data.heightHint = convertHeightInCharsToPixels(5);
	control.setLayoutData(data);

	return viewer;
}
 
開發者ID:UndefinedOffset,項目名稱:eclipse-silverstripedt,代碼行數:19,代碼來源:NewSilverStripeClassWizardTemplatePage.java

示例9: createViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
private SourceViewer createViewer(Composite parent, int nColumns) {
	Label label = new Label(parent, SWT.NONE);
	label.setText(JSDTTypeScriptUIMessages.CodeTemplateBlock_preview);
	GridData data = new GridData();
	data.horizontalSpan = nColumns;
	label.setLayoutData(data);

	IDocument document = new Document();
	JavaScriptTextTools tools = JavaScriptPlugin.getDefault().getJavaTextTools();
	tools.setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING);
	IPreferenceStore store = JavaScriptPlugin.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);
	viewer.setDocument(document);

	Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
	viewer.getTextWidget().setFont(font);
	new TypeScriptSourcePreviewerUpdater(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;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:32,代碼來源:CodeTemplateBlock.java

示例10: createViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的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;
	}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:37,代碼來源:CodeTemplateBlock.java

示例11: runBehindSmokescreen

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
/**
 * This is pretty hacky, but this code comes straight from the JDT's
 * RenameLinkedMode class. Its doRename() method uses this method to hide the
 * fact that it rolls back the document changes made during a linked-mode
 * rename refactoring before reapplying the changes through the regular rename
 * refactoring processor. If we can find a different way to work around the
 * visual quirk caused by JDT's auto-format-on-save-bug, we should definitely
 * use that instead.
 * 
 * @param action the editor operation to run hidden
 */
private void runBehindSmokescreen(Runnable action) {
  Image image = null;
  Label label = null;

  try {
    ISourceViewer viewer = getViewer();
    if (viewer instanceof SourceViewer) {
      SourceViewer sourceViewer = (SourceViewer) viewer;
      Control viewerControl = sourceViewer.getControl();
      if (viewerControl instanceof Composite) {
        Composite composite = (Composite) viewerControl;
        Display display = composite.getDisplay();

        // Flush pending redraw requests
        while (!display.isDisposed() && display.readAndDispatch()) {
        }

        // Copy editor area into an Image
        GC gc = new GC(composite);
        Point size;
        try {
          size = composite.getSize();
          image = new Image(gc.getDevice(), size.x, size.y);
          gc.copyArea(image, 0, 0);
        } finally {
          gc.dispose();
          gc = null;
        }

        // Hide the editor area behind the Image
        label = new Label(composite, SWT.NONE);
        label.setImage(image);
        label.setBounds(0, 0, size.x, size.y);
        label.moveAbove(null);
      }
    }

    // Perform the action
    action.run();

  } finally {
    if (label != null) {
      label.dispose();
    }
    if (image != null) {
      image.dispose();
    }
  }
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:61,代碼來源:GWTJavaEditor.java


注:本文中的org.eclipse.jface.text.source.SourceViewer.getControl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。