本文整理匯總了Java中com.intellij.openapi.command.CommandProcessor.getCurrentCommandName方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandProcessor.getCurrentCommandName方法的具體用法?Java CommandProcessor.getCurrentCommandName怎麽用?Java CommandProcessor.getCurrentCommandName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.command.CommandProcessor
的用法示例。
在下文中一共展示了CommandProcessor.getCurrentCommandName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: logErrorHeader
import com.intellij.openapi.command.CommandProcessor; //導入方法依賴的package包/類
private void logErrorHeader() {
final String info = ourApplicationInfoProvider.getInfo();
if (info != null) {
myLogger.error(info);
}
if (ourCompilationTimestamp != null) {
myLogger.error("Internal version. Compiled " + ourCompilationTimestamp);
}
myLogger.error("JDK: " + System.getProperties().getProperty("java.version", "unknown"));
myLogger.error("VM: " + System.getProperties().getProperty("java.vm.name", "unknown"));
myLogger.error("Vendor: " + System.getProperties().getProperty("java.vendor", "unknown"));
myLogger.error("OS: " + System.getProperties().getProperty("os.name", "unknown"));
ApplicationImpl application = (ApplicationImpl)ApplicationManager.getApplication();
if (application != null && application.isComponentsCreated() && !application.isDisposed()) {
final String lastPreformedActionId = ourLastActionId;
if (lastPreformedActionId != null) {
myLogger.error("Last Action: " + lastPreformedActionId);
}
CommandProcessor commandProcessor = CommandProcessor.getInstance();
if (commandProcessor != null) {
final String currentCommandName = commandProcessor.getCurrentCommandName();
if (currentCommandName != null) {
myLogger.error("Current Command: " + currentCommandName);
}
}
}
}
示例2: beforeDocumentChange
import com.intellij.openapi.command.CommandProcessor; //導入方法依賴的package包/類
@Override
public void beforeDocumentChange(DocumentEvent e) {
if (myDeaf) return;
if (DumbService.isDumb(myProject)) return;
if (myInitialText == null) {
final Document document = e.getDocument();
final PsiDocumentManager documentManager = myPsiDocumentManager;
if (!documentManager.isUncommited(document)) {
final CommandProcessor processor = CommandProcessor.getInstance();
final String currentCommandName = processor.getCurrentCommandName();
if (!Comparing.strEqual(TYPING_COMMAND_NAME, currentCommandName) &&
!Comparing.strEqual(PASTE_COMMAND_NAME, currentCommandName) &&
!Comparing.strEqual("Cut", currentCommandName) &&
!Comparing.strEqual(LanguageChangeSignatureDetector.MOVE_PARAMETER, currentCommandName) &&
!Comparing.equal(EditorActionUtil.DELETE_COMMAND_GROUP, processor.getCurrentCommandGroupId())) {
return;
}
final PsiFile file = documentManager.getPsiFile(document);
if (file != null) {
final PsiElement element = file.findElementAt(e.getOffset());
if (element != null) {
final ChangeInfo info = createInitialChangeInfo(element);
if (info != null) {
final PsiElement method = info.getMethod();
final TextRange textRange = method.getTextRange();
if (document.getTextLength() <= textRange.getEndOffset()) return;
if (method instanceof PsiNameIdentifierOwner) {
myInitialName = ((PsiNameIdentifierOwner)method).getName();
}
myInitialText = document.getText(textRange);
myInitialChangeInfo = info;
}
}
}
}
}
}