// component stuff @Override public void initComponent() { boolean useIoFile = RuntimeFlags.isTestMode() && RuntimeFlags.isUseIOFile(); if (!useIoFile) { // setup filesystem provider FileSystem.getInstance().setFileSystemProvider(this); } }
@Override public void clear() { if (RuntimeFlags.isTestMode()) { return; } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { if (myIsDisposed) { return; } myModel.clear(); myMessages.clear(); myErrors = 0; myWarnings = 0; myInfos = 0; myHintObjects = 0; myList.setFixedCellWidth(myList.getWidth()); updateHeader(); updateActions(); } }); }
@Override public String getRoleName() { if (RuntimeFlags.isMergeDriverMode() || myIsBootstrap) { return myName; } ReferenceDescriptor d = getReferenceDescriptor(); if (d == null) { // invalid property, needed for propertyRead event in SNode until event is rewritten return myName; } return d.getName(); }
public void show(boolean setActive) { if (RuntimeFlags.isTestMode()) { return; } if (myIsDisposed) { return; } ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW); if (!window.isAvailable()) window.setAvailable(true, null); if (!window.isVisible()) window.show(null); if (setActive) window.activate(null); Content content = getMessagesService().getContentManager().getContent(myComponent); getMessagesService().getContentManager().setSelectedContent(content); }
@Override public boolean isTestMode() { return RuntimeFlags.isTestMode(); }
public boolean isExecutionInProcess() { return RuntimeFlags.getTestMode() == TestMode.IN_PROCESS; }
@Override public void add(IMessage message) { if (RuntimeFlags.isTestMode()) { return; } myMessagesInProgress.incrementAndGet(); myMessagesQueue.add(message); myUpdateQueue.queue( new Update(myUpdateIdentity) { @Override public void run() { if (myIsDisposed) { return; } List<IMessage> messagesToAdd = new ArrayList<IMessage>(); while (!myMessagesQueue.isEmpty()) { IMessage message = myMessagesQueue.remove(); myMessagesInProgress.decrementAndGet(); if (isVisible(message)) { messagesToAdd.add(message); } myMessages.add(message); updateMessageCounters(message, 1); } int messagesToRemove = 0; if (myMessages.size() > MessageList.this.myMaxListSize) { for (int i = Math.min( myMessages.size() - MessageList.this.myMaxListSize, myMessages.size()); i > 0; i--) { IMessage toRemove = myMessages.remove(); updateMessageCounters(toRemove, -1); if (isVisible(toRemove)) { messagesToRemove++; } } if (messagesToRemove > myModel.getSize()) { messagesToAdd = messagesToAdd.subList( messagesToRemove - myModel.getSize(), messagesToAdd.size()); messagesToRemove = myModel.getSize(); } } if (messagesToRemove > 0) { myModel.removeFirst(messagesToRemove); } myModel.addAll(messagesToAdd); int maxWidth = -1; for (IMessage message : messagesToAdd) { maxWidth = Math.max(maxWidth, getMessageWidth(message)); } int index = myModel.getSize() - 1; if (myList.getAutoscrolls()) { myList.getSelectionModel().setSelectionInterval(index, index); } if (myMessagesInProgress.get() == 0) { myList.ensureIndexIsVisible(index); } if (maxWidth > myList.getFixedCellWidth()) { myList.setFixedCellWidth(maxWidth); } updateHeader(); updateActions(); } private void updateMessageCounters(IMessage m, int delta) { if (m.getKind() == MessageKind.ERROR) { myErrors += delta; } if (m.getKind() == MessageKind.WARNING) { myWarnings += delta; } if (m.getKind() == MessageKind.INFORMATION) { myInfos += delta; } if (m.getHintObject() != null) { myHintObjects += delta; } } }); }