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


Java ILinkedModeListener类代码示例

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


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

示例1: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * If the entered character is not a valid identifier part, it is processed after linked editing has been quit.
 * Exceptions are the {@link #exitCharacters} that have been passed into the constructor.
 */
@Override
public ExitFlags doExit(LinkedModeModel environment, VerifyEvent event, int offset, int length) {
	if (event.character == '\0')
		return null;
	for (char c : exitCharacters) {
		if (event.character == c) {
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
		}
	}
	switch (event.character) {
	case SWT.CR:
		return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
	default: {
		if (!Character.isJavaIdentifierPart(event.character)) {
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
		}
		return null;
	}
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:IdentifierExitPolicy.java

示例2: registerAutoEditVetoer

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
/**
 * Registers our auto edit vetoer with the viewer.
 *
 * @param viewer
 *            the viewer we want to veto ui-triggered changes within linked
 *            positions
 */
private void registerAutoEditVetoer(ITextViewer viewer) {
	try {
		String[] contentTypes = getContentTypes(viewer.getDocument());
		if (viewer instanceof ITextViewerExtension2) {
			ITextViewerExtension2 vExtension = ((ITextViewerExtension2) viewer);
			for (int i = 0; i < contentTypes.length; i++) {
				vExtension.prependAutoEditStrategy(fAutoEditVetoer, contentTypes[i]);
			}
		} else {
			Assert.isTrue(false);
		}

	} catch (BadPartitioningException e) {
		leave(ILinkedModeListener.EXIT_ALL);
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:24,代码来源:TweakedLinkedModeUI.java

示例3: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {
    
    if (fSize == fStack.size() && !isMasked(offset)) {
        if (event.character == fExitCharacter) {
            BracketLevel level= (BracketLevel) fStack.peek();
            if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
                return null;
            if (level.fSecondPosition.offset == offset && length == 0)
                // don't enter the character if if its the closing peer
                return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
        }
        // when entering an anonymous class between the parenthesis', we don't want
        // to jump after the closing parenthesis when return is pressed
        if (event.character == SWT.CR && offset > 0) {
            IDocument document= sourceViewer.getDocument();
            try {
                if (document.getChar(offset - 1) == '{')
                    return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
            } catch (BadLocationException e) {
            }
        }
    }
    return null;
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:25,代码来源:BracketInserter.java

示例4: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {

			if (fSize == fStack.size() && !isMasked(offset)) {
				if (event.character == fExitCharacter) {
					BracketLevel level = (BracketLevel) fStack.peek();
					if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
						return null;
					if (level.fSecondPosition.offset == offset && length == 0)
						// don't enter the character if if its the closing peer
						return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
				}
				// when entering an anonymous class between the parenthesis', we
				// don't want
				// to jump after the closing parenthesis when return is pressed
				if (event.character == SWT.CR && offset > 0) {
					IDocument document = getSourceViewer().getDocument();
					try {
						if (document.getChar(offset - 1) == '{')
							return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
					} catch (BadLocationException e) {
					}
				}
			}
			return null;
		}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:26,代码来源:BracketInserter.java

示例5: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public ExitFlags doExit(LinkedModeModel environment, VerifyEvent event, int offset, int length) {
	if (event.character == '\0')
		return null;
	for (char c: exitCharacters) {
		if (event.character == c) {
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
		}
	}

	switch (event.character) {
		case SWT.CR:
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
		default:
			return null;
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:ConfigurableCompletionProposal.java

示例6: linkedModeLeft

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
/**
 * PopUp gets closed and the focus goes back to the editor. Linked mode stays active and can be reenabled, i.e. by
 * putting the caret back into a linked editing position.
 */
public void linkedModeLeft() {
	if (linkedModeModel != null) {
		linkedModeModel.exit(ILinkedModeListener.NONE);
	}
	if (popup != null) {
		popup.close();
	}

	if (editor != null) {
		ISourceViewer viewer = editor.getInternalSourceViewer();
		if (viewer instanceof IEditingSupportRegistry) {
			IEditingSupportRegistry registry = (IEditingSupportRegistry) viewer;
			registry.unregister(focusEditingSupport);
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:RenameLinkedMode.java

示例7: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event,
		int offset, int length) {
	if (!isMasked(offset)) {
		if (event.character == fExit)
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET,
					false);
		if (event.character == '\r' || event.character == '\n'
				&& offset > 0) {
			try {
				if (fDocument.getChar(offset - 1) == '{') {
					return new ExitFlags(ILinkedModeListener.EXIT_ALL,
							true);
				}
			} catch (BadLocationException e) {
			}
		}
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:20,代码来源:JSONCharacterPairInserter.java

示例8: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length)
{
	if (shouldInsertNewline())
	{
		if (event.character == '\n' || event.character == '\r')
		{
			return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
		}
	}

	if (event.character != fExitCharacter)
		return null;

	if (fSize == fStack.size() && !isEscaped(offset))
	{
		BracketLevel level = fStack.peek();
		if (offset < level.fFirstPosition.offset || level.fSecondPosition.offset < offset)
			return null;
		if (level.fSecondPosition.offset == offset && length == 0)
			// don't enter the character if it is the closing peer
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
	}

	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:ExitPolicy.java

示例9: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {

			if (fSize == fStack.size() && !isMasked(offset)) {
				if (event.character == fExitCharacter) {
					BracketLevel level= fStack.peek();
					if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
						return null;
					if (level.fSecondPosition.offset == offset && length == 0)
						// don't enter the character if if its the closing peer
						return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
				}
				// when entering an anonymous class between the parenthesis', we don't want
				// to jump after the closing parenthesis when return is pressed
				if (event.character == SWT.CR && offset > 0) {
					IDocument document= getSourceViewer().getDocument();
					try {
						if (document.getChar(offset - 1) == '{')
							return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
					} catch (BadLocationException e) {
					}
				}
			}
			return null;
		}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:CompilationUnitEditor.java

示例10: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
@Override
public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) {

    if (fSize == fStack.size() && !isMasked(offset)) {
        if (event.character == fExitCharacter) {
            BracketLevel level = fStack.peek();
            if (level.fFirstPosition.offset > offset || level.fSecondPosition.offset < offset)
                return null;
            if (level.fSecondPosition.offset == offset && length == 0)
                // don't enter the character if if its the closing peer
                return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
        }
        // when entering an anonymous class between the parenthesis', we don't want
        // to jump after the closing parenthesis when return is pressed
        if (event.character == SWT.CR && offset > 0) {
            IDocument document = getSourceViewer().getDocument();
            try {
                if (document.getChar(offset - 1) == '{')
                    return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
            } catch (BadLocationException e) {}
        }
    }
    return null;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:25,代码来源:BracketInserter.java

示例11: doExit

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
@Override
public ExitFlags doExit(LinkedModeModel environment, VerifyEvent event, int offset, int length) {

	if (event.character == fExitCharacter) {
		if (environment.anyPositionContains(offset))
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, false);
		else
			return new ExitFlags(ILinkedModeListener.UPDATE_CARET, true);
	}

	switch (event.character) {
	case ';':
		return new ExitFlags(ILinkedModeListener.NONE, true);
	case SWT.CR:
		// when entering an anonymous class as a parameter, we don't
		// want
		// to jump after the parenthesis when return is pressed
		if (offset > 0) {
			try {
				if (fDocument.getChar(offset - 1) == '{')
					return new ExitFlags(ILinkedModeListener.EXIT_ALL, true);
			} catch (BadLocationException e) {
			}
		}
		return null;
	default:
		return null;
	}
}
 
开发者ID:angelozerr,项目名称:ec4e,代码行数:30,代码来源:EditorConfigCompletionProposal.java

示例12: resume

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public void resume(LinkedModeModel model, int flags) {
	if ((flags & ILinkedModeListener.EXIT_ALL) != 0) {
		leave(flags);
	} else {
		connect();
		if ((flags & ILinkedModeListener.SELECT) != 0)
			select();
		ensureAnnotationModelInstalled();
		redraw();
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:12,代码来源:TweakedLinkedModeUI.java

示例13: documentAboutToBeChanged

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
public void documentAboutToBeChanged(DocumentEvent event) {

			// default behavior: any document change outside a linked position
			// causes us to exit
			int end = event.getOffset() + event.getLength();
			for (int offset = event.getOffset(); offset <= end; offset++) {
				if (!fModel.anyPositionContains(offset)) {
					ITextViewer viewer = fCurrentTarget.getViewer();
					if (fFramePosition != null && viewer instanceof IEditingSupportRegistry) {
						IEditingSupport[] helpers = ((IEditingSupportRegistry) viewer).getRegisteredSupports();
						for (int i = 0; i < helpers.length; i++) {
							if (helpers[i].isOriginator(null,
									new Region(fFramePosition.getOffset(), fFramePosition.getLength())))
								return;
						}
					}

					leave(ILinkedModeListener.EXTERNAL_MODIFICATION);
					return;
				}
			}

			// Make sure that any document change is done inside a compound
			// change
			beginCompoundChangeIfNeeded();

		}
 
开发者ID:curiosag,项目名称:ftc,代码行数:28,代码来源:TweakedLinkedModeUI.java

示例14: next

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
void next() {
	if (fIterator.hasNext(fFramePosition)) {
		switchPosition(fIterator.next(fFramePosition), true, true);
		return;
	}
	leave(ILinkedModeListener.UPDATE_CARET);
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:8,代码来源:TweakedLinkedModeUI.java

示例15: previous

import org.eclipse.jface.text.link.ILinkedModeListener; //导入依赖的package包/类
void previous() {
	if (fIterator.hasPrevious(fFramePosition)) {
		switchPosition(fIterator.previous(fFramePosition), true, true);
	} else
		// dont't update caret, but rather select the current frame
		leave(ILinkedModeListener.SELECT);
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:8,代码来源:TweakedLinkedModeUI.java


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