Example usage for org.apache.commons.lang.time StopWatch StopWatch

List of usage examples for org.apache.commons.lang.time StopWatch StopWatch

Introduction

In this page you can find the example usage for org.apache.commons.lang.time StopWatch StopWatch.

Prototype

public StopWatch() 

Source Link

Document

Constructor.

Usage

From source file:net.nan21.dnet.core.web.controller.data.AbstractAsgnController.java

@RequestMapping(method = RequestMethod.POST, params = Constants.REQUEST_PARAM_ACTION + "="
        + Constants.ASGN_ACTION_MOVE_RIGHT_ALL)
@ResponseBody/*from  www .j  a  v  a2s. c  o  m*/
public String moveRightAll(@PathVariable String resourceName, @PathVariable String dataFormat,
        @RequestParam(value = Constants.REQUEST_PARAM_ASGN_OBJECT_ID, required = true) String objectId,
        @RequestParam(value = Constants.REQUEST_PARAM_ASGN_SELECTION_ID, required = true) String selectionId,
        @RequestParam(value = "data", required = false, defaultValue = "{}") String dataString,
        @RequestParam(value = "params", required = false, defaultValue = "{}") String paramString,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {

        StopWatch stopWatch = new StopWatch();
        stopWatch.start();

        if (logger.isInfoEnabled()) {
            logger.info("Processing request: {}.{} -> action = {} ",
                    new String[] { resourceName, dataFormat, Constants.ASGN_ACTION_MOVE_RIGHT_ALL });
        }

        if (logger.isDebugEnabled()) {
            logger.debug("  --> request-filter: objectId={}, selectionId={} data={}",
                    new String[] { objectId, selectionId, dataString });
            logger.debug("  --> request-params: {} ", new String[] { paramString });
        }

        this.prepareRequest(request, response);

        this.authorizeAsgnAction(resourceName, "update");

        IAsgnService<M, F, P> service = this.findAsgnService(this.serviceNameFromResourceName(resourceName));

        IDsMarshaller<M, F, P> marshaller = service.createMarshaller(dataFormat);

        F filter = marshaller.readFilterFromString(dataString);
        P params = marshaller.readParamsFromString(paramString);

        service.moveRightAll(selectionId, filter, params);
        stopWatch.stop();

        return "";
    } catch (Exception e) {
        return this.handleException(e, response);
    } finally {
        this.finishRequest();
    }

}

From source file:com.liferay.mail.imap.IMAPAccessor.java

public void storeEnvelopes(long folderId, Folder jxFolder, Message[] jxMessages) throws PortalException {

    StopWatch stopWatch = new StopWatch();

    stopWatch.start();/*from w  w  w .  j  av a  2 s .  co m*/

    try {
        FetchProfile fetchProfile = new FetchProfile();

        fetchProfile.add(UIDFolder.FetchProfileItem.ENVELOPE);
        fetchProfile.add(UIDFolder.FetchProfileItem.FLAGS);
        fetchProfile.add(UIDFolder.FetchProfileItem.UID);

        jxFolder.fetch(jxMessages, fetchProfile);

        for (Message jxMessage : jxMessages) {
            String sender = InternetAddressUtil.toString(jxMessage.getFrom());
            String to = InternetAddressUtil.toString(jxMessage.getRecipients(RecipientType.TO));
            String cc = InternetAddressUtil.toString(jxMessage.getRecipients(RecipientType.CC));
            String bcc = InternetAddressUtil.toString(jxMessage.getRecipients(RecipientType.BCC));
            Date sentDate = jxMessage.getSentDate();
            String subject = jxMessage.getSubject();
            String flags = getFlags(jxMessage);
            long remoteMessageId = getUID(jxFolder, jxMessage);
            String contentType = jxMessage.getContentType();

            try {
                MessageLocalServiceUtil.getMessage(folderId, remoteMessageId);
            } catch (NoSuchMessageException nsme) {
                MessageLocalServiceUtil.addMessage(_user.getUserId(), folderId, sender, to, cc, bcc, sentDate,
                        subject, StringPool.BLANK, flags, remoteMessageId, contentType);
            }
        }

        com.liferay.mail.model.Folder folder = FolderLocalServiceUtil.getFolder(folderId);

        FolderLocalServiceUtil.updateFolder(folderId, folder.getFullName(), folder.getDisplayName(),
                jxFolder.getMessageCount());
    } catch (MessagingException me) {
        throw new MailException(me);
    }

    if (_log.isDebugEnabled()) {
        stopWatch.stop();

        _log.debug("Downloaded " + jxMessages.length + " messages from folder " + jxFolder.getFullName()
                + " completed in " + stopWatch.getTime() + " ms");
    }
}

From source file:com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.java

protected User addUser(long companyId, LDAPUser ldapUser, String password) throws Exception {

    StopWatch stopWatch = new StopWatch();

    if (_log.isDebugEnabled()) {
        stopWatch.start();/*w  w w  .  j av a  2  s.  c  o m*/

        _log.debug(StringBundler.concat("Adding LDAP user ", String.valueOf(ldapUser), " to company ",
                String.valueOf(companyId)));
    }

    boolean autoPassword = ldapUser.isAutoPassword();

    LDAPImportConfiguration ldapImportConfiguration = _ldapImportConfigurationProvider
            .getConfiguration(companyId);

    if (!ldapImportConfiguration.importUserPasswordEnabled()) {
        autoPassword = ldapImportConfiguration.importUserPasswordAutogenerated();

        if (!autoPassword) {
            String defaultPassword = ldapImportConfiguration.importUserPasswordDefault();

            if (StringUtil.equalsIgnoreCase(defaultPassword, _USER_PASSWORD_SCREEN_NAME)) {

                defaultPassword = ldapUser.getScreenName();
            }

            password = defaultPassword;
        }
    }

    Calendar birthdayCal = CalendarFactoryUtil.getCalendar();

    birthdayCal.setTime(ldapUser.getBirthday());

    int birthdayMonth = birthdayCal.get(Calendar.MONTH);
    int birthdayDay = birthdayCal.get(Calendar.DAY_OF_MONTH);
    int birthdayYear = birthdayCal.get(Calendar.YEAR);

    User user = _userLocalService.addUser(ldapUser.getCreatorUserId(), companyId, autoPassword, password,
            password, ldapUser.isAutoScreenName(), ldapUser.getScreenName(), ldapUser.getEmailAddress(), 0,
            StringPool.BLANK, ldapUser.getLocale(), ldapUser.getFirstName(), ldapUser.getMiddleName(),
            ldapUser.getLastName(), 0, 0, ldapUser.isMale(), birthdayMonth, birthdayDay, birthdayYear,
            StringPool.BLANK, ldapUser.getGroupIds(), ldapUser.getOrganizationIds(), ldapUser.getRoleIds(),
            ldapUser.getUserGroupIds(), ldapUser.isSendEmail(), ldapUser.getServiceContext());

    if (ldapUser.isUpdatePortrait()) {
        byte[] portraitBytes = ldapUser.getPortraitBytes();

        if (ArrayUtil.isNotEmpty(portraitBytes)) {
            user = _userLocalService.updatePortrait(user.getUserId(), portraitBytes);
        }
    }

    if (_log.isDebugEnabled()) {
        _log.debug(StringBundler.concat("Finished adding LDAP user ", String.valueOf(ldapUser), " as user ",
                String.valueOf(user), " in ", String.valueOf(stopWatch.getTime()), "ms"));
    }

    return user;
}

From source file:com.mothsoft.alexis.dao.DocumentDaoImpl.java

private DataRange<DocumentScore> searchWithAllOptions(final Long userId, final boolean requireTopicsForUser,
        final DocumentState state, final String queryString, final SortOrder sortOrder, final Date startDate,
        final Date endDate, final int first, final int count) {
    final StopWatch stopWatch = new StopWatch();
    stopWatch.start();//from   ww  w  .  ja  va 2s  .  com

    final FullTextQuery fullTextQuery = this.buildFullTextQuery(queryString, userId, startDate, endDate,
            requireTopicsForUser, state, FullTextQuery.THIS, FullTextQuery.SCORE);

    fullTextQuery.setFirstResult(first);
    fullTextQuery.setMaxResults(count);

    // optional sort order
    if (sortOrder == null || sortOrder == SortOrder.RELEVANCE) {
        final Sort defaultSort = new Sort(SortField.FIELD_SCORE, new SortField("id", SortField.LONG, true));
        fullTextQuery.setSort(defaultSort);
    } else if (sortOrder == SortOrder.DATE_DESC) {
        final Sort sort = new Sort(new SortField("creationDate", SortField.LONG, true));
        fullTextQuery.setSort(sort);
    } else if (sortOrder == SortOrder.DATE_ASC) {
        final Sort sort = new Sort(new SortField("creationDate", SortField.LONG));
        fullTextQuery.setSort(sort);
    }

    @SuppressWarnings("unchecked")
    final List<Object[]> results = fullTextQuery.list();
    final List<DocumentScore> range = new ArrayList<DocumentScore>(results.size());

    // copy to DocumentScore holder objects
    for (final Object[] ith : results) {
        final Document ithDoc = (Document) ith[0];
        final Float ithScore = (Float) ith[1];
        range.add(new DocumentScore(ithDoc, ithScore));
    }

    final int totalRows = fullTextQuery.getResultSize();
    final DataRange<DocumentScore> result = new DataRange<DocumentScore>(range, first, totalRows);

    stopWatch.stop();
    logger.debug(stopWatch.toString());
    return result;
}

From source file:edu.internet2.middleware.psp.grouper.PspChangeLogConsumer.java

/** {@inheritDoc} */
public long processChangeLogEntries(final List<ChangeLogEntry> changeLogEntryList,
        ChangeLogProcessorMetadata changeLogProcessorMetadata) {

    // the change log sequence number to return
    long sequenceNumber = -1;

    // initialize this consumer's name from the change log metadata
    if (name == null) {
        name = changeLogProcessorMetadata.getConsumerName();
        LOG.trace("PSP Consumer '{}' - Setting name.", name);
    }//from w  ww. j a va 2 s.c  om

    // time context processing
    StopWatch stopWatch = new StopWatch();
    // the last change log sequence number processed
    String lastContextId = null;

    LOG.debug("PSP Consumer '{}' - Processing change log entry list size '{}'", name,
            changeLogEntryList.size());

    // process each change log entry
    for (ChangeLogEntry changeLogEntry : changeLogEntryList) {

        // return the current change log sequence number
        sequenceNumber = changeLogEntry.getSequenceNumber();

        // if full sync is running, return the previous sequence number to process this entry on the next run
        if (fullSyncIsRunning) {
            LOG.info("PSP Consumer '{}' - Full sync is running, returning sequence number '{}'", name,
                    sequenceNumber - 1);
            return sequenceNumber - 1;
        }

        // if first run, start the stop watch and store the last sequence number
        if (lastContextId == null) {
            stopWatch.start();
            lastContextId = changeLogEntry.getContextId();
        }

        // whether or not an exception was thrown during processing of the change log entry
        boolean errorOccurred = false;

        try {
            // process the change log entry
            processChangeLogEntry(changeLogEntry);
        } catch (Exception e) {
            errorOccurred = true;
            String message = "PSP Consumer '" + name + "' - An error occurred processing sequence number "
                    + sequenceNumber;
            LOG.error(message, e);
            changeLogProcessorMetadata.registerProblem(e, message, sequenceNumber);
            changeLogProcessorMetadata.setHadProblem(true);
            changeLogProcessorMetadata.setRecordException(e);
            changeLogProcessorMetadata.setRecordExceptionSequence(sequenceNumber);
        }

        // if the change log context id has changed, log and restart stop watch
        if (!lastContextId.equals(changeLogEntry.getContextId())) {
            stopWatch.stop();
            LOG.debug("PSP Consumer '{}' - Processed change log context '{}' Elapsed time {}",
                    new Object[] { name, lastContextId, stopWatch, });
            stopWatch.reset();
            stopWatch.start();
        }

        lastContextId = changeLogEntry.getContextId();

        // if an error occurs and retry on error is true, return the current sequence number minus 1
        if (errorOccurred && retryOnError) {
            sequenceNumber--;
            break;
        }
    }

    // stop the timer and log
    stopWatch.stop();
    LOG.debug("PSP Consumer '{}' - Processed change log context '{}' Elapsed time {}",
            new Object[] { name, lastContextId, stopWatch, });

    if (sequenceNumber == -1) {
        LOG.error("PSP Consumer '" + name + "' - Unable to process any records.");
        throw new RuntimeException("PSP Consumer '" + name + "' - Unable to process any records.");
    }

    LOG.debug("PSP Consumer '{}' - Finished processing change log entries. Last sequence number '{}'", name,
            sequenceNumber);

    // return the sequence number
    return sequenceNumber;
}

From source file:net.nan21.dnet.core.web.controller.data.AbstractAsgnController.java

/**
 * Cancel changes/*from w  w  w.j  a  v a2  s. c  om*/
 * 
 * @param resourceName
 * @param dataFormat
 * @param objectId
 * @param selectionId
 * @param request
 * @param response
 * @return
 * @throws Exception
 */
@RequestMapping(method = RequestMethod.POST, params = Constants.REQUEST_PARAM_ACTION + "="
        + Constants.ASGN_ACTION_RESET)
@ResponseBody
public String reset(@PathVariable String resourceName, @PathVariable String dataFormat,
        @RequestParam(value = Constants.REQUEST_PARAM_ASGN_OBJECT_ID, required = true) String objectId,
        @RequestParam(value = Constants.REQUEST_PARAM_ASGN_SELECTION_ID, required = true) String selectionId,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    try {

        StopWatch stopWatch = new StopWatch();
        stopWatch.start();

        if (logger.isInfoEnabled()) {
            logger.info("Processing request: {}.{} -> action = {} ",
                    new String[] { resourceName, dataFormat, Constants.ASGN_ACTION_RESET });
        }

        if (logger.isDebugEnabled()) {
            logger.debug("  --> request-filter: objectId={}, selectionId={} ",
                    new String[] { objectId, selectionId });
        }

        this.prepareRequest(request, response);

        IAsgnService<M, F, P> service = this.findAsgnService(this.serviceNameFromResourceName(resourceName));

        service.reset(selectionId, objectId);
        stopWatch.stop();

        return "";
    } catch (Exception e) {
        return this.handleException(e, response);
    } finally {
        this.finishRequest();
    }
}

From source file:biz.netcentric.cq.tools.actool.aceservice.impl.AceServiceImpl.java

private void installAuthorizables(AcInstallationHistoryPojo history,
        Set<AuthorizableInstallationHistory> authorizableHistorySet,
        Map<String, Set<AuthorizableConfigBean>> authorizablesMapfromConfig)
        throws RepositoryException, Exception {
    // --- installation of Authorizables from configuration ---

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();/*from  www . j  av  a  2  s .  c  o  m*/

    String msg = "*** Starting installation of " + authorizablesMapfromConfig.size() + " authorizables...";
    LOG.info(msg);
    history.addMessage(msg);

    // create own session for installation of authorizables since these have
    // to be persisted in order
    // to have the principals available when installing the ACEs

    // therefore the installation of all ACEs from all configurations uses
    // an own session (which get passed as
    // parameter to this method), which only get saved when no exception was
    // thrown during the installation of the ACEs

    // in case of an exception during the installation of the ACEs the
    // performed installation of authorizables from config
    // has to be reverted using the rollback method
    Session authorizableInstallationSession = repository.loginAdministrative(null);
    try {
        // only save session if no exceptions occured
        AuthorizableInstallationHistory authorizableInstallationHistory = new AuthorizableInstallationHistory();
        authorizableHistorySet.add(authorizableInstallationHistory);
        authorizableCreatorService.createNewAuthorizables(authorizablesMapfromConfig,
                authorizableInstallationSession, history, authorizableInstallationHistory);
        authorizableInstallationSession.save();
    } catch (Exception e) {
        throw new AuthorizableCreatorException(e);
    } finally {
        if (authorizableInstallationSession != null) {
            authorizableInstallationSession.logout();
        }
    }

    String message = "Finished installation of authorizables without errors in "
            + AcInstallationHistoryPojo.msHumanReadable(stopWatch.getTime());
    history.addMessage(message);
    LOG.info(message);
}

From source file:eagle.service.generic.GenericEntityServiceResource.java

/**
 * TODO//w  ww  . j a v a2s . c  om
 *
 * Delete by query
 *
 * @return
 */
@DELETE
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public GenericServiceAPIResponseEntity deleteByQuery(@QueryParam("query") String query,
        @QueryParam("startTime") String startTime, @QueryParam("endTime") String endTime,
        @QueryParam("pageSize") int pageSize, @QueryParam("startRowkey") String startRowkey,
        @QueryParam("treeAgg") boolean treeAgg, @QueryParam("timeSeries") boolean timeSeries,
        @QueryParam("intervalmin") long intervalmin, @QueryParam("top") int top,
        @QueryParam("filterIfMissing") boolean filterIfMissing, @QueryParam("parallel") int parallel,
        @QueryParam("metricName") String metricName, @QueryParam("verbose") Boolean verbose) {
    RawQuery rawQuery = RawQuery.build().query(query).startTime(startTime).endTime(endTime).pageSize(pageSize)
            .startRowkey(startRowkey).treeAgg(treeAgg).timeSeries(timeSeries).intervalMin(intervalmin).top(top)
            .filerIfMissing(filterIfMissing).parallel(parallel).metricName(metricName).verbose(verbose).done();

    GenericServiceAPIResponseEntity response = new GenericServiceAPIResponseEntity();
    Map<String, Object> meta = new HashMap<String, Object>();
    DataStorage dataStorage = null;
    StopWatch stopWatch = new StopWatch();
    try {
        stopWatch.start();
        dataStorage = DataStorageManager.getDataStorageByEagleConfig();
        if (dataStorage == null) {
            LOG.error("Data storage is null");
            throw new IllegalDataStorageException("Data storage is null");
        }

        DeleteStatement deleteStatement = new DeleteStatement(rawQuery);
        ModifyResult<String> deleteResult = deleteStatement.execute(dataStorage);
        if (deleteResult.isSuccess()) {
            meta.put(ELAPSEDMS, stopWatch.getTime());
            response.setObj(deleteResult.getIdentifiers(), String.class);
            response.setSuccess(true);
            response.setMeta(meta);
        }
        return response;
    } catch (Exception e) {
        response.setException(e);
        LOG.error(e.getMessage(), e);
    } finally {
        stopWatch.stop();
    }
    return response;
}

From source file:com.ecyrd.jspwiki.filters.SpamFilter.java

/**
 *  Checks against the akismet system./*from   w ww  . j  a v  a2s .co m*/
 *
 * @param context
 * @param change
 * @throws RedirectException
 */
private void checkAkismet(WikiContext context, Change change) throws RedirectException {
    if (m_akismetAPIKey != null) {
        if (m_akismet == null) {
            log.info("Initializing Akismet spam protection.");

            m_akismet = new Akismet(m_akismetAPIKey, context.getEngine().getBaseURL());

            if (!m_akismet.verifyAPIKey()) {
                log.error("Akismet API key cannot be verified.  Please check your config.");
                m_akismetAPIKey = null;
                m_akismet = null;
            }
        }

        HttpServletRequest req = context.getHttpRequest();

        //
        //  Akismet will mark all empty statements as spam, so we'll just
        //  ignore them.
        //
        if (change.m_adds == 0 && change.m_removals > 0) {
            return;
        }

        if (req != null && m_akismet != null) {
            log.debug("Calling Akismet to check for spam...");

            StopWatch sw = new StopWatch();
            sw.start();

            String ipAddress = req.getRemoteAddr();
            String userAgent = req.getHeader("User-Agent");
            String referrer = req.getHeader("Referer");
            String permalink = context.getViewURL(context.getPage().getName());
            String commentType = context.getRequestContext().equals(WikiContext.COMMENT) ? "comment" : "edit";
            String commentAuthor = context.getCurrentUser().getName();
            String commentAuthorEmail = null;
            String commentAuthorURL = null;

            boolean isSpam = m_akismet.commentCheck(ipAddress, userAgent, referrer, permalink, commentType,
                    commentAuthor, commentAuthorEmail, commentAuthorURL, change.toString(), null);

            sw.stop();

            log.debug("Akismet request done in: " + sw);

            if (isSpam) {
                // Host host = new Host( ipAddress, null );

                // m_temporaryBanList.add( host );

                String uid = log(context, REJECT, REASON_AKISMET, change.toString());

                log.info("SPAM:Akismet (" + uid
                        + "). Akismet thinks this change is spam; added host to temporary ban list.");

                checkStrategy(context, REASON_AKISMET,
                        "Akismet tells Herb you're a spammer, Herb trusts Akismet, and I trust Herb! (Incident code "
                                + uid + ")");
            }
        }
    }
}

From source file:com.intellij.lang.jsgraphql.ide.project.JSGraphQLLanguageUIProjectService.java

public void executeGraphQL(Editor editor, VirtualFile virtualFile) {
    final JSGraphQLEndpointsModel endpointsModel = editor.getUserData(JS_GRAPH_QL_ENDPOINTS_MODEL);
    if (endpointsModel != null) {
        final JSGraphQLEndpoint selectedEndpoint = endpointsModel.getSelectedItem();
        if (selectedEndpoint != null && selectedEndpoint.url != null) {
            final JSGraphQLQueryContext context = JSGraphQLQueryContextHighlightVisitor
                    .getQueryContextBufferAndHighlightUnused(editor);
            final Map<String, Object> requestData = Maps.newLinkedHashMap();
            requestData.put("query", context.query);
            try {
                requestData.put("variables", getQueryVariables(editor));
            } catch (JsonSyntaxException jse) {
                if (myToolWindowManagerInitialized) {
                    myToolWindowManager.logCurrentErrors(ContainerUtil.immutableList(
                            new JSGraphQLErrorResult("Failed to parse variables as JSON: " + jse.getMessage(),
                                    virtualFile.getPath(), "Error", 0, 0)),
                            true);//w w w . ja v  a  2s  . c o m
                }
                return;
            }
            final String requestJson = new Gson().toJson(requestData);
            final HttpClient httpClient = new HttpClient(new HttpClientParams());
            try {
                final PostMethod method = new PostMethod(selectedEndpoint.url);
                setHeadersFromOptions(selectedEndpoint, method);
                method.setRequestEntity(new StringRequestEntity(requestJson, "application/json", "UTF-8"));
                ApplicationManager.getApplication().executeOnPooledThread(() -> {
                    try {
                        try {
                            editor.putUserData(JS_GRAPH_QL_EDITOR_QUERYING, true);
                            StopWatch sw = new StopWatch();
                            sw.start();
                            httpClient.executeMethod(method);
                            final String responseJson = Optional.fromNullable(method.getResponseBodyAsString())
                                    .or("");
                            sw.stop();
                            final Integer errorCount = getErrorCount(responseJson);
                            if (fileEditor instanceof TextEditor) {
                                final TextEditor textEditor = (TextEditor) fileEditor;
                                UIUtil.invokeLaterIfNeeded(() -> {
                                    ApplicationManager.getApplication().runWriteAction(() -> {
                                        final Document document = textEditor.getEditor().getDocument();
                                        document.setText(responseJson);
                                        if (requestJson.startsWith("{")) {
                                            final PsiFile psiFile = PsiDocumentManager.getInstance(myProject)
                                                    .getPsiFile(document);
                                            if (psiFile != null) {
                                                new ReformatCodeProcessor(psiFile, false).run();
                                            }
                                        }
                                    });
                                    final StringBuilder queryResultText = new StringBuilder(
                                            virtualFile.getName()).append(": ").append(sw.getTime())
                                                    .append(" ms execution time, ")
                                                    .append(bytesToDisplayString(responseJson.length()))
                                                    .append(" response");

                                    if (errorCount != null && errorCount > 0) {
                                        queryResultText.append(", ").append(errorCount).append(" error")
                                                .append(errorCount > 1 ? "s" : "");
                                        if (context.onError != null) {
                                            context.onError.run();
                                        }
                                    }

                                    queryResultLabel.setText(queryResultText.toString());
                                    queryResultLabel.putClientProperty(FILE_URL_PROPERTY, virtualFile.getUrl());
                                    if (!queryResultLabel.isVisible()) {
                                        queryResultLabel.setVisible(true);
                                    }

                                    querySuccessLabel.setVisible(errorCount != null);
                                    if (querySuccessLabel.isVisible()) {
                                        if (errorCount == 0) {
                                            querySuccessLabel
                                                    .setBorder(BorderFactory.createEmptyBorder(2, 8, 0, 0));
                                            querySuccessLabel.setIcon(AllIcons.General.InspectionsOK);
                                        } else {
                                            querySuccessLabel
                                                    .setBorder(BorderFactory.createEmptyBorder(2, 12, 0, 4));
                                            querySuccessLabel.setIcon(AllIcons.Ide.ErrorPoint);
                                        }
                                    }
                                    showToolWindowContent(myProject, fileEditor.getComponent().getClass());
                                    textEditor.getEditor().getScrollingModel().scrollVertically(0);
                                });
                            }
                        } finally {
                            editor.putUserData(JS_GRAPH_QL_EDITOR_QUERYING, null);
                        }
                    } catch (IOException e) {
                        Notifications.Bus.notify(
                                new Notification("GraphQL", "GraphQL Query Error",
                                        selectedEndpoint.url + ": " + e.getMessage(), NotificationType.WARNING),
                                myProject);
                    }
                });
            } catch (UnsupportedEncodingException | IllegalStateException | IllegalArgumentException e) {
                Notifications.Bus.notify(
                        new Notification("GraphQL", "GraphQL Query Error",
                                selectedEndpoint.url + ": " + e.getMessage(), NotificationType.ERROR),
                        myProject);
            }

        }
    }
}