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


Java SourceViewer.getDocument方法代碼示例

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


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

示例1: createViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
protected  SourceViewer createViewer (Composite composite) {
	SourceViewer viewer = ViewerHelper.createEditor(composite);	
	viewer.getControl().setData(WIDGET_ID, WIDGET_ACTION_SCRIPT);
	FocusListener listener = new FocusListener() {
		@Override
		public void focusGained(FocusEvent e) {
		}

		@Override
		public void focusLost(FocusEvent event) {
			if (!notification) return;
            if (viewer.getDocument() == null) return;
            String content  = viewer.getDocument().get();
            getProperties().setPropertyValue(ModelProperties.PROPERTY_EDGE_ACTION, content);

		}
	};
	viewer.getControl().addFocusListener(listener);
	return viewer;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:21,代碼來源:EdgeActionSection.java

示例2: createViewer

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
protected  SourceViewer createViewer (Composite composite) {
	SourceViewer viewer = ViewerHelper.createEditor(composite);	
	viewer.getControl().setData(WIDGET_ID, WIDGET_GUARD_SCRIPT);
	FocusListener listener = new FocusListener() {
		@Override
		public void focusGained(FocusEvent e) {
		}

		@Override
		public void focusLost(FocusEvent event) {
			if (!notification) return;
            if (viewer.getDocument() == null) return;
            String content  = viewer.getDocument().get();
            getProperties().setPropertyValue(ModelProperties.PROPERTY_EDGE_GUARD, content);
		}
	};
	viewer.getControl().addFocusListener(listener);
	return viewer;		
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:20,代碼來源:EdgeGuardSection.java

示例3: 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));
		}
	}
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:17,代碼來源:DefaultMergeViewer.java

示例4: updateViewerInput

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
protected void updateViewerInput() {
	IStructuredSelection selection= (IStructuredSelection) getTableViewer().getSelection();
	SourceViewer viewer= getViewer();
	
	if (selection.size() == 1 && selection.getFirstElement() instanceof TemplatePersistenceData) {
		TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement();
		Template template= data.getTemplate();
		String contextId= template.getContextTypeId();
		TemplateContextType type= JSDTTypeScriptUIPlugin.getDefault().getTemplateContextRegistry().getContextType(contextId);
		fTemplateProcessor.setContextType(type);
		
		IDocument doc= viewer.getDocument();
		
		String start= null;
		if ("javadoc".equals(contextId)) { //$NON-NLS-1$
			start= "/**" + doc.getLegalLineDelimiters()[0]; //$NON-NLS-1$
		} else
			start= ""; //$NON-NLS-1$
		
		doc.set(start + template.getPattern());
		int startLen= start.length();
		viewer.setDocument(doc, startLen, doc.getLength() - startLen);

	} else {
		viewer.getDocument().set(""); //$NON-NLS-1$
	}		
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:28,代碼來源:TypeScriptTemplatePreferencePage.java

示例5: updateViewerInput

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
@Override
protected void updateViewerInput() {
	IStructuredSelection selection= (IStructuredSelection) getTableViewer().getSelection();
	SourceViewer viewer= getViewer();

	if (selection.size() == 1 && selection.getFirstElement() instanceof TemplatePersistenceData) {
		TemplatePersistenceData data= (TemplatePersistenceData) selection.getFirstElement();
		Template template= data.getTemplate();
		String contextId= template.getContextTypeId();
		TemplateContextType type= JavaPlugin.getDefault().getTemplateContextRegistry().getContextType(contextId);
		fTemplateProcessor.setContextType(type);

		IDocument doc= viewer.getDocument();

		String start= null;
		if ("javadoc".equals(contextId)) { //$NON-NLS-1$
			start= "/**" + doc.getLegalLineDelimiters()[0]; //$NON-NLS-1$
		} else
			start= ""; //$NON-NLS-1$

		doc.set(start + template.getPattern());
		int startLen= start.length();
		viewer.setDocument(doc, startLen, doc.getLength() - startLen);

	} else {
		viewer.getDocument().set(""); //$NON-NLS-1$
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:29,代碼來源:JavaTemplatePreferencePage.java

示例6: createPartControl

import org.eclipse.jface.text.source.SourceViewer; //導入方法依賴的package包/類
public void createPartControl( Composite parent )
{
	Composite child = this.initEditorLayout( parent );

	// Script combo
	cmbExprListViewer = new ComboViewer( cmbExpList );
	JSExpListProvider provider = new JSExpListProvider( );
	cmbExprListViewer.setContentProvider( provider );
	cmbExprListViewer.setLabelProvider( provider );
	cmbExprListViewer.setData( VIEWER_CATEGORY_KEY, VIEWER_CATEGORY_CONTEXT );

	// SubFunctions combo
	JSSubFunctionListProvider subProvider = new JSSubFunctionListProvider( this );

	// also add subProvider as listener of expr viewer.
	cmbExprListViewer.addSelectionChangedListener( subProvider );

	cmbSubFunctions.addListener( CustomChooserComposite.DROPDOWN_EVENT,
			new Listener( ) {

				public void handleEvent( Event event )
				{
					cmbSubFunctions.deselectAll( );

					ScriptParser parser = new ScriptParser( getEditorText( ) );

					Collection<IScriptMethodInfo> coll = parser.getAllMethodInfo( );

					for ( Iterator<IScriptMethodInfo> itr = coll.iterator( ); itr.hasNext( ); )
					{
						IScriptMethodInfo mtd = itr.next( );

						cmbSubFunctions.markSelection( METHOD_DISPLAY_INDENT
								+ mtd.getName( ) );
					}
				}

			} );

	cmbSubFunctionsViewer = new TextComboViewer( cmbSubFunctions );
	cmbSubFunctionsViewer.setContentProvider( subProvider );
	cmbSubFunctionsViewer.setLabelProvider( subProvider );
	cmbSubFunctionsViewer.addSelectionChangedListener( subProvider );
	cmbSubFunctionsViewer.addSelectionChangedListener( propertyDefnChangeListener );

	// Initialize the model for the document.
	Object model = getModel( );
	if ( model != null )
	{
		cmbExpList.setVisible( true );
		cmbSubFunctions.setVisible( true );
		setComboViewerInput( model );
	}
	else
	{
		setComboViewerInput( Messages.getString( "JSEditor.Input.trial" ) ); //$NON-NLS-1$
	}
	cmbExprListViewer.addSelectionChangedListener( palettePage.getSupport( ) );
	cmbExprListViewer.addSelectionChangedListener( propertyDefnChangeListener );

	scriptEditor.createPartControl( child );
	scriptValidator = new ScriptValidator( getViewer( ) );

	disableEditor( );

	SourceViewer viewer = getViewer( );
	IDocument document = viewer == null ? null : viewer.getDocument( );

	if ( document != null )
	{
		IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager( document );

		if ( undoManager != null )
		{
			undoManager.addDocumentUndoListener( undoListener );
		}
		document.addDocumentListener( documentListener );
	}
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:80,代碼來源:JSEditor.java


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