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


Java TextEditor类代码示例

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


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

示例1: createAdditionalPage

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
@Override
public String createAdditionalPage(MultiPageEditorPart parent, IFileEditorInput file, int pageNum) {

	// Create the specified page
	switch (pageNum) {

	// Page 2 is the file's data displayed in text
	case 1:

		// Create a text editor with the file as input and add its page with
		// the name Data
		try {
			editor = (IEditorPart) new TextEditor();
			parent.addPage(editor, file);
			return "Data";
		} catch (PartInitException e) {
			logger.error("Error initializing text editor for CSV Plot Editor.");
		}
		break;
	}

	// If the page number is not supported, return null
	return null;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:25,代码来源:CSVPlot.java

示例2: createMessagesBundlePage

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates a new text editor for the messages bundle, which gets added to a new page
 */
protected void createMessagesBundlePage(MessagesBundle messagesBundle) {
    try {
        IMessagesResource resource = messagesBundle.getResource();
        final TextEditor textEditor = (TextEditor) resource.getSource();
        int index = addPage(textEditor, textEditor.getEditorInput());
        setPageText(index,
                UIUtils.getDisplayName(messagesBundle.getLocale()));
        setPageImage(index, UIUtils.getImage(UIUtils.IMAGE_PROPERTIES_FILE));
        localesIndex.add(messagesBundle.getLocale());
        textEditorsIndex.add(textEditor);            
    } catch (PartInitException e) {
        ErrorDialog.openError(getSite().getShell(),
                "Error creating text editor page.", //$NON-NLS-1$
                null, e.getStatus());
    }
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:AbstractMessagesEditor.java

示例3: removeMessagesBundle

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Removes the text editor page + the entry from the i18n page of the given locale and messages bundle.
 */
protected void removeMessagesBundle(MessagesBundle messagesBundle) {
    IMessagesResource resource = messagesBundle.getResource();
    final TextEditor textEditor = (TextEditor) resource.getSource();
    // index + 1 because of i18n page
    int pageIndex = textEditorsIndex.indexOf(textEditor) + 1;
    removePage(pageIndex);

    textEditorsIndex.remove(textEditor);
    localesIndex.remove(messagesBundle.getLocale());

    textEditor.dispose();

    // remove entry from i18n page
    i18nPage.removeI18NEntry(messagesBundle.getLocale());        
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:19,代码来源:AbstractMessagesEditor.java

示例4: createPage0

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates page 0 of the multi-page editor,
 * which contains a text editor.
 */
void createPage0() {
	try {
		editor = new TextEditor();
	

		int index = addPage(editor, getEditorInput());
		setPageText(index, editor.getTitle());
	
	
		IHandlerService serv = (IHandlerService) getSite().getService(IHandlerService.class);
		MyCopyHandler cp = new MyCopyHandler();
		serv.activateHandler(org.eclipse.ui.IWorkbenchCommandConstants.EDIT_PASTE, cp);
		//serv.activateHandler(org.eclipse.ui.IWorkbenchCommandConstants.EDIT_, cp);

	} catch (PartInitException e) {
		ErrorDialog.openError(
			getSite().getShell(),
			"Error creating nested text editor",
			null,
			e.getStatus());
	}
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:27,代码来源:ExperimentConfigurationEditor.java

示例5: createPage0

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates page 0 of the multi-page editor, which contains a text editor.
 */
void createPage0() {
	try {
		editor = new TextEditor();
		int index = addPage(editor, getEditorInput());
		setPageText(index, "XML");
		setPartName(((FileEditorInput) editor.getEditorInput()).getFile().getName());
	} catch (PartInitException e) {
		ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:14,代码来源:TypesEditor.java

示例6: getAdapter

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
	if (adapterType == IToggleBreakpointsTarget.class) {
		if (adaptableObject instanceof ExtensionBasedTextEditor || adaptableObject instanceof TextEditor) {
			return (T) new DSPBreakpointAdapter();
		}
	}
	return null;
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:11,代码来源:DSPEditorAdapterFactory.java

示例7: createPageSource

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates page 1 of the multi-page editor, which allows you to change the
 * font used in page 2.
 */
void createPageSource() {
	try {
		editor = new TextEditor();
		int index = addPage(editor, getEditorInput());
		setPageText(index, "Source");
	} catch (PartInitException e) {
		ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:14,代码来源:PropEditor.java

示例8: createSourcePage

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates the source page.
 */
void createSourcePage() {
	try {
		editor = new TextEditor();
		int index = addPage(editor, getEditorInput());
		setPageText(index, "Source");
	} catch (PartInitException e) {
		ErrorDialog.openError(
			getSite().getShell(),
			"Error creating nested text editor",
			null,
			e.getStatus());
	}
}
 
开发者ID:germanattanasio,项目名称:traceability-assistant-eclipse-plugins,代码行数:17,代码来源:DXMIEditor.java

示例9: sourcePage

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates a View Source page
 */
void sourcePage() {
	try {
		editor = new TextEditor();
		int index = addPage(editor, getEditorInput());
		setPageText(index, "Source");
	} catch (PartInitException e) {
		ErrorDialog.openError(getSite().getShell(),"Error creating nested text editor", null, e.getStatus());
	}
}
 
开发者ID:germanattanasio,项目名称:traceability-assistant-eclipse-plugins,代码行数:13,代码来源:TraceabilityEditor.java

示例10: createPrimaryPage

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
protected void createPrimaryPage(TextEditor editor) {
    try {
        this.editor = editor;
        pageIndex = addPage(editor, getEditorInput());
        setPageText(pageIndex, editor.getTitle());
        setPartName(editor.getTitle());
    } catch (PartInitException e) {
        handlePartInitException(
                e,
                "Part Initialization Failure",
                "Failed to create primary page.");
    }
}
 
开发者ID:insweat,项目名称:hssd,代码行数:14,代码来源:MultiPageEditorWithTextPage.java

示例11: createPages

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * Creates the pages of the multi-page editor.
 */
protected void createPages() {
    // Create I18N page
    i18nPage = new I18NPage(
            getContainer(), SWT.NONE, this);
    int index = addPage(i18nPage);
    setPageText(index, MessagesEditorPlugin.getString(
            "editor.properties")); //$NON-NLS-1$
    setPageImage(index, UIUtils.getImage(UIUtils.IMAGE_RESOURCE_BUNDLE));
    
    // Create text editor pages for each locales
    try {
        Locale[] locales = messagesBundleGroup.getLocales();
        //first: sort the locales.
        UIUtils.sortLocales(locales);
        //second: filter+sort them according to the filter preferences.
        locales = UIUtils.filterLocales(locales);
        for (int i = 0; i < locales.length; i++) {
        	Locale locale = locales[i];
            MessagesBundle messagesBundle = messagesBundleGroup.getMessagesBundle(locale);
            IMessagesResource resource = messagesBundle.getResource();
            TextEditor textEditor = (TextEditor) resource.getSource();
            index = addPage(textEditor, textEditor.getEditorInput());
            setPageText(index, UIUtils.getDisplayName(
                    messagesBundle.getLocale()));
            setPageImage(index, 
                    UIUtils.getImage(UIUtils.IMAGE_PROPERTIES_FILE));
            localesIndex.add(locale);
            textEditorsIndex.add(textEditor);
        } 
    } catch (PartInitException e) {
        ErrorDialog.openError(getSite().getShell(), 
            "Error creating text editor page.", //$NON-NLS-1$
            null, e.getStatus());
    }
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:39,代码来源:MessagesEditor.java

示例12: execute

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
	 * the command has been executed, so extract extract the needed information
	 * from the application context.
	 */
	public Object execute(ExecutionEvent event) throws ExecutionException {
//		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
//		MessageDialog.openInformation(
//				window.getShell(),
//				"Ide",
//				"Show mapping");

		IEditorPart editor = HandlerUtil.getActiveEditor(event);
		if ( editor instanceof AtlEditorExt ) {
			AtlEditorExt atlEditor = (AtlEditorExt) editor;
			IFile file = (IFile) atlEditor.getUnderlyingResource();
			
			AnalysisResult r = AnalysisIndex.getInstance().getAnalysisOrLoad(file);
			if ( r == null )
				return null;
			
			//MappingDialog dialog = new MappingDialog(HandlerUtil.getActiveShell(event), new AtlTransformationMapping(r.getAnalyser()));
			//dialog.open();
			
			IDocument doc = ((TextEditor) atlEditor).getDocumentProvider().getDocument(atlEditor.getEditorInput());
			
			showView(r.getAnalyser(), doc);
		}
		
		return null;
	}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:31,代码来源:ShowMappingHandler.java

示例13: setEditorContents

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
public static void setEditorContents(String in, TextEditor editor, final int newCursorPosition) {
  IDocumentProvider prov = editor.getDocumentProvider();
  IDocument doc = prov.getDocument(editor.getEditorInput());
  int currentCursorPosition = getcursorPosition(editor);
  ConsoleActions.debug("Current positions is:" + currentCursorPosition);
  doc.set(in);
  editor.getSelectionProvider().setSelection(
      new OurSelectionProvider(newCursorPosition, currentCursorPosition));
}
 
开发者ID:joereddington,项目名称:EclipseEditorPluginExample,代码行数:10,代码来源:EditorActions.java

示例14: getLineNumberForCharNumber

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
/**
 * 
 * Returns the line number, given a character number.
 * 
 * @param editor
 * @param target
 * @return
 */
public static int getLineNumberForCharNumber(TextEditor editor, int target) {
  String editorContents = editorContents(editor);
  String[] lines = editorContents.split("\\n");
  int charsLeft = target;
  for (int i = 0; i < lines.length; i++) {
    if (charsLeft <= lines[i].length()) {
      return i;
    }
    charsLeft = charsLeft - lines[i].length();
  }
  return -1;// because there are more chars than lines to hold them..
}
 
开发者ID:joereddington,项目名称:EclipseEditorPluginExample,代码行数:21,代码来源:EditorActions.java

示例15: setEditorSelection

import org.eclipse.ui.editors.text.TextEditor; //导入依赖的package包/类
private static void setEditorSelection(IEditorPart editor, Position pos, int lineNum)
{
    if(editor instanceof TextEditor) {
        int offset = -1;
        int length = 0;
        IDocument doc = ((TextEditor)editor).getDocumentProvider().getDocument(editor.getEditorInput());
        if(pos != null) {
            if(pos.getOffset() >= 0 && doc.getLength() >= pos.getOffset()+pos.getLength()) {
                offset = pos.getOffset();
                length = pos.getLength();
            }
        }
        else {
            if(doc.getNumberOfLines() >= lineNum) {
                try {
                    IRegion region = doc.getLineInformation(lineNum-1);
                    offset = region.getOffset();
                    length = region.getLength();
                }
                catch (BadLocationException e) {
                    EclipseNSISPlugin.getDefault().log(e);
                }
            }
        }
        ((TextEditor)editor).getSelectionProvider().setSelection(new TextSelection(doc,offset,length));
    }
}
 
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:28,代码来源:NSISEditorUtilities.java


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