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


Java AbstractTextEditor类代码示例

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


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

示例1: editorOpened

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
private void editorOpened(IEditorPart part) {
	if (part instanceof AbstractTextEditor) {
		AbstractTextEditor editor = (AbstractTextEditor) part;
		ApplyEditorConfig apply = applies.get(editor);
		if (apply == null) {
			try {
				apply = new ApplyEditorConfig(editor);
				apply.install();
				applies.put(editor, apply);
			} catch (Exception e) {
				e.printStackTrace();
				return;
			}
		}
		apply.applyConfig();
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:18,代码来源:EditorTracker.java

示例2: findClass

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
public void findClass(String className){
	setLinkToEditor(getEditor());		
	String resource = removeExt(getResource(getEditor()).getName());
	String ext = getResource(getEditor()).getFileExtension();
	
	String classNameToFind = (ext == null) ? className : className+"."+ext;
	if (!resource.equals(className)){
		IContainer parent = getResource(getEditor()).getParent();
		IResource file = parent.findMember(classNameToFind);
		try {
			setLinkToEditor((AbstractTextEditor)SootPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput((IFile)file), file.getName()));
		}
		catch (PartInitException e){
		}
		
	}
	
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:SootAttributeJimpleSelectAction.java

示例3: TexlipseAnnotationUpdater

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
/**
 * Creates a new TexlipseAnnotationUpdater and adds itself to the TexEditor via
 * <code>addPostSelectionChangedListener</code>
 * @param editor The TexEditor
 */
public TexlipseAnnotationUpdater (AbstractTextEditor editor) {
    //Add this listener to the current editors IPostSelectionListener (lazy update)
    ((IPostSelectionProvider) editor.getSelectionProvider()).addPostSelectionChangedListener(this);
    fEditor = editor;
    fEnabled = TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(
            TexlipseProperties.TEX_EDITOR_ANNOTATATIONS);
    
    //Add a PropertyChangeListener
    TexlipsePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new  
            IPropertyChangeListener() {
        
        public void propertyChange(PropertyChangeEvent event) {    
            String property = event.getProperty();
            if (TexlipseProperties.TEX_EDITOR_ANNOTATATIONS.equals(property)) {
                boolean enabled = TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(
                                TexlipseProperties.TEX_EDITOR_ANNOTATATIONS);
                fEnabled = enabled;
            }
        }
    });
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:27,代码来源:TexlipseAnnotationUpdater.java

示例4: configurePreferenceKeys

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
private void configurePreferenceKeys() {
	preferenceKeysForEnablement = new HashSet<>();
	preferenceKeysForActivation = new HashSet<>();
	// Global settings (master switch)
	preferenceKeysForEnablement
			.add(AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED);
	preferenceKeysForActivation
			.add(AbstractTextEditor.PREFERENCE_HYPERLINK_KEY_MODIFIER);
	// All applicable individual hyperlink detectors settings.
	Map targets = configuration.getHyperlinkDetectorTargets(this);
	for (HyperlinkDetectorDescriptor desc : EditorsUI
			.getHyperlinkDetectorRegistry()
			.getHyperlinkDetectorDescriptors()) {
		if (targets.keySet().contains(desc.getTargetId())) {
			preferenceKeysForEnablement.add(desc.getId());
			preferenceKeysForActivation.add(desc.getId()
					+ HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX);
		}
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:21,代码来源:HyperlinkSourceViewer.java

示例5: getHyperlinkDetectors

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
private IHyperlinkDetector[] getHyperlinkDetectors() {
	IHyperlinkDetector[] allDetectors;
	IHyperlinkDetector[] configuredDetectors = configuration
			.getHyperlinkDetectors(viewer);
	if (configuredDetectors == null || configuredDetectors.length == 0) {
		allDetectors = new IHyperlinkDetector[0];
	} else if (preferenceStore.getBoolean(URL_HYPERLINK_DETECTOR_KEY)
			|| !preferenceStore.getBoolean(
					AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED)) {
		allDetectors = configuredDetectors;
	} else {
		allDetectors = new IHyperlinkDetector[configuredDetectors.length
				+ 1];
		System.arraycopy(configuredDetectors, 0, allDetectors, 0,
				configuredDetectors.length);
		// URLHyperlinkDetector can only detect hyperlinks at the start of
		// the range. We need one that can detect all hyperlinks in a given
		// region.
		allDetectors[configuredDetectors.length] = new MultiURLHyperlinkDetector();
	}
	return allDetectors;
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:23,代码来源:HyperlinkTokenScanner.java

示例6: initDefaults

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
/**
 * 
 */
public static void initDefaults(IPreferenceStore aStore)
{
    PreferenceConverter.setDefault(aStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
    aStore.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true);
    PreferenceConverter.setDefault(aStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
    aStore.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DEFAULT, RGB_DEFAULT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_TAG, RGB_DIRECTIVE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_SCRIPT, RGB_SCRIPT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_COMMENT, RGB_COMMENT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DOC_COMMENT, RGB_DOC_COMMENT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DIRECTIVE, RGB_DIRECTIVE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_STRING, RGB_STRING);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_REFERENCE, RGB_REFERENCE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_STRING_REFERENCE, RGB_STRING_REFERENCE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_String, RGB_HTML_String);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_ENDTAG, RGB_HTML_ENDTAG);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_TAG, RGB_HTML_TAG);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_ATTRIBUTE, RGB_HTML_ATTRIBUTE);
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:24,代码来源:EditorPreferencePage.java

示例7: setAptanaEditorColorsToMatchTheme

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
/**
 * Set the FG, BG, selection and current line colors on our editors.
 * 
 * @param theme
 */
private void setAptanaEditorColorsToMatchTheme(Theme theme)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode("com.aptana.editor.common"); //$NON-NLS-1$
	prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, false);
	prefs.put(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND, toString(theme.getForeground()));

	prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false);
	prefs.put(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, toString(theme.getBackground()));

	prefs.putBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, false);
	prefs.put(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, toString(theme.getForeground()));

	prefs.put(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR,
			toString(theme.getLineHighlightAgainstBG()));
	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(ThemePlugin.getDefault(), e);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:29,代码来源:ThemeManager.java

示例8: getSourceViewer

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
public static ISourceViewer getSourceViewer(ITextEditor textEditor)
{
	if (textEditor instanceof IThemeableEditor)
	{
		IThemeableEditor editor = (IThemeableEditor) textEditor;
		return editor.getISourceViewer();
	}
	if (textEditor instanceof AbstractTextEditor)
	{
		try
		{
			Method m = AbstractTextEditor.class.getDeclaredMethod("getSourceViewer"); //$NON-NLS-1$
			m.setAccessible(true);
			return (ISourceViewer) m.invoke(textEditor);
		}
		catch (Exception e)
		{
			// ignore
		}
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:23,代码来源:TextEditorUtils.java

示例9: handlePreferenceStoreChanged

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
public void handlePreferenceStoreChanged(PropertyChangeEvent event)
{
	if (event.getProperty().equals(IThemeManager.THEME_CHANGED))
	{
		IThemeableEditor editor = this.fEditor.get();
		overrideThemeColors();
		if (editor != null)
		{
			editor.getISourceViewer().invalidateTextPresentation();
		}
	}
	else if (event.getProperty().equals(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE))
	{
		Object newValue = event.getNewValue();
		if (newValue instanceof Boolean)
		{
			boolean on = (Boolean) newValue;
			fFullLineBackgroundPainter.setHighlightLineEnabled(on);
		}
	}
	else if (event.getProperty().equals(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT))
	{
		overrideRulerColors();
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:ThemeableEditorExtension.java

示例10: getVisibleBackgroundColor

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
/**
 * Returns <code>null</code> if {@link SWT#COLOR_INFO_BACKGROUND} is visibly distinct from the
 * default Java source text color. Otherwise, returns the editor background color.
 * 
 * @param display the display
 * @return an RGB or <code>null</code>
 * @since 3.6.1
 */
public static RGB getVisibleBackgroundColor(Display display) {
	float[] infoBgHSB= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB().getHSB();
	
	Color javaDefaultColor= JavaUI.getColorManager().getColor(IJavaColorConstants.JAVA_DEFAULT);
	RGB javaDefaultRGB= javaDefaultColor != null ? javaDefaultColor.getRGB() : new RGB(255, 255, 255);
	float[] javaDefaultHSB= javaDefaultRGB.getHSB();
	
	if (Math.abs(infoBgHSB[2] - javaDefaultHSB[2]) < 0.5f) {
		// workaround for dark tooltip background color, see https://bugs.eclipse.org/309334
		IPreferenceStore preferenceStore= JavaPlugin.getDefault().getCombinedPreferenceStore();
		boolean useDefault= preferenceStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT);
		if (useDefault)
			return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
		return PreferenceConverter.getColor(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:SourceViewerInformationControl.java

示例11: partActivated

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
@Override
public void partActivated(IWorkbenchPartReference partRef) {
    IEditorPart part = partRef.getPage().getActiveEditor();
    if (!(part instanceof AbstractTextEditor))
        return;

    // log new active file
    IEditorInput input = part.getEditorInput();
    if (input instanceof IURIEditorInput) {
        URI uri = ((IURIEditorInput)input).getURI();
        if (uri != null && uri.getPath() != null) {
            String currentFile = uri.getPath();
            long currentTime = System.currentTimeMillis() / 1000;
            if (!currentFile.equals(WakaTime.getDefault().lastFile) || WakaTime.getDefault().lastTime + WakaTime.FREQUENCY * 60 < currentTime) {
                WakaTime.sendHeartbeat(currentFile, WakaTime.getActiveProject(), false);
                WakaTime.getDefault().lastFile = currentFile;
                WakaTime.getDefault().lastTime = currentTime;
            }
        }
    }
}
 
开发者ID:wakatime,项目名称:eclipse-wakatime,代码行数:22,代码来源:CustomEditorListener.java

示例12: getEclipseEditorForeground

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
public static Color getEclipseEditorForeground( )
{
	ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE,
			"org.eclipse.ui.editors" );//$NON-NLS-1$
	Color color = null;
	if ( preferenceStore != null )
	{
		color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT ) ? null
				: createColor( preferenceStore,
						AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
						Display.getCurrent( ) );
	}
	if ( color == null )
	{
		color = Display.getDefault( )
				.getSystemColor( SWT.COLOR_LIST_FOREGROUND );
	}
	return color;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:UIUtil.java

示例13: getEclipseEditorBackground

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
public static Color getEclipseEditorBackground( )
{
	ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE,
			"org.eclipse.ui.editors" );//$NON-NLS-1$
	Color color = null;
	if ( preferenceStore != null )
	{
		color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT ) ? null
				: createColor( preferenceStore,
						AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
						Display.getCurrent( ) );
	}
	if ( color == null )
	{
		color = Display.getDefault( )
				.getSystemColor( SWT.COLOR_LIST_BACKGROUND );
	}
	return color;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:UIUtil.java

示例14: pageChanged

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
@Override
public void pageChanged(PageChangedEvent event) {
	Object selectedPage = event.getSelectedPage();
	if (seenPages.contains(selectedPage))
		return;
	
	seenPages.add(selectedPage);
	if (selectedPage instanceof AbstractTextEditor) {
		IEditorPart editorPart = (IEditorPart) selectedPage;
		IProject project = plugin.getProjectForEditor(editorPart.getEditorInput());
		if (plugin.getIgnoreProjectsList().contains(project.getName()))
			return;
		ISourceViewer sourceViewer = (ISourceViewer) editorPart.getAdapter(ITextOperationTarget.class);
		sourceViewer.getDocument().addDocumentListener(new DocumentListener());
	}
}
 
开发者ID:ChangeOrientedProgrammingEnvironment,项目名称:eclipseRecorder,代码行数:17,代码来源:MultiEditorPageChangedListener.java

示例15: getRegion

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入依赖的package包/类
private IRegion getRegion(IDocument document, ILineRange lineRange) throws BadLocationException {
    final int startLine = lineRange.getStartLine();
    int offset = document.getLineOffset(startLine);
    final int numberOfLines = lineRange.getNumberOfLines();
    if (numberOfLines < 1) {
        return new Region(offset, 0);
    }
    int endLine = startLine + numberOfLines - 1;
    int endOffset;
    boolean blockSelectionModeEnabled = false;
    try {
        blockSelectionModeEnabled = ((AbstractTextEditor) getTextEditor()).isBlockSelectionModeEnabled();
    } catch (Throwable e) {
        //Ignore (not available before 3.5)
    }
    if (blockSelectionModeEnabled) {
        // in block selection mode, don't select the last delimiter as we count an empty selected line
        IRegion endLineInfo = document.getLineInformation(endLine);
        endOffset = endLineInfo.getOffset() + endLineInfo.getLength();
    } else {
        endOffset = document.getLineOffset(endLine) + document.getLineLength(endLine);
    }
    return new Region(offset, endOffset - offset);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:25,代码来源:PyMoveLineAction.java


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