Examples of ILogResource


Examples of net.sf.logsaw.core.logresource.ILogResource

        }
        Assert.isTrue(obj.isConfigured(), "Dialect should be configured by now"); //$NON-NLS-1$
      }
     
      // Create the log resource
      final ILogResource log = logResourcePage.createLogResource(dialectInstance);
      Assert.isTrue(log.isConfigured(), "Log resource should be configured by now"); //$NON-NLS-1$
      UIPlugin.getDefault().getLogResourceManager().add(log);
      UIPlugin.getDefault().getLogResourceManager().saveState();
      UIPlugin.getDefault().getLogResourceManager().synchronize(log,
          new IGenericCallback<SynchronizationResult>() {
       
        @Override
        public void doCallback(final SynchronizationResult payload) {
          Display.getDefault().asyncExec(new Runnable() {

            /* (non-Javadoc)
             * @see java.lang.Runnable#run()
             */
            @Override
            public void run() {
              IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
              IEditorReference[] editorRefs = page.findEditors(
                  (IEditorInput) log.getAdapter(IEditorInput.class),
                  null, IWorkbenchPage.MATCH_INPUT);
              for (IEditorReference editorRef : editorRefs) {
                // Refresh editor
                IEditorPart editorPart = editorRef.getEditor(false);
                ILogViewEditor editor = editorPart != null ?
                    (ILogViewEditor) editorPart.getAdapter(ILogViewEditor.class) : null;
                if (editor != null) {
                  editor.clearQueryContext();
                  editor.refresh();
                }
              }
              NumberFormat fmt = DecimalFormat.getInstance();
              String title = payload.isCanceled() ?
                  Messages.SynchronizeLogResourceAction_canceled_title :
                    Messages.SynchronizeLogResourceAction_finished_title;
              String message = payload.isCanceled() ?
                  Messages.SynchronizeLogResourceAction_canceled_message :
                    Messages.SynchronizeLogResourceAction_finished_message;
              message = NLS.bind(message, new Object[] {
                  log.getName(),
                  UIUtils.formatRuntime(payload.getRuntime()),
                  fmt.format(payload.getNumberOfEntriesAdded())});
              if (payload.getMessages().isEmpty()) {
                // Everything is fine
                MessageDialog.openInformation(Display.getDefault().getActiveShell(),
View Full Code Here

Examples of net.sf.logsaw.core.logresource.ILogResource

        .getSelection();
    if ((selection != null) && (selection instanceof IStructuredSelection)) {
      Object obj = ((IStructuredSelection) selection).getFirstElement();
      // If we had a selection lets open the editor
      if (obj != null) {
        ILogResource log = (ILogResource) obj;
        try {
          page.openEditor((IEditorInput) log.getAdapter(IEditorInput.class), LogViewEditor.ID);
        } catch (PartInitException e) {
          // Log and show error
          UIPlugin.logAndShowError(e, false);
        }
      }
View Full Code Here

Examples of net.sf.logsaw.core.logresource.ILogResource

        // Restore config options of dialect
        loadConfigOptions(dialectElem, (IConfigurableObject) dialect.getAdapter(IConfigurableObject.class));
        String pk = logElem.getChild(ELEM_PK).getTextData();
       
        // TODO Dynamic factory for log resource
        ILogResource log = SimpleLogResourceFactory.getInstance().createLogResource();
        log.setDialect(dialect);
        log.setName(name);
        log.setPK(pk);
       
        // Restore config options of resource
        loadConfigOptions(logElem, (IConfigurableObject) log.getAdapter(IConfigurableObject.class));
       
        // Unlock if necessary
        if (IndexPlugin.getDefault().getIndexService().unlock(log)) {
          logger.warn("Unlocked log resource " + log.getName()); //$NON-NLS-1$
        }
        // Register log resource
        registerLogResource(log);
      } catch (Exception e) {
        statuses.add(new Status(IStatus.ERROR, UIPlugin.PLUGIN_ID,
View Full Code Here

Examples of net.sf.logsaw.core.logresource.ILogResource

    cleanUp(false, true);
    File logFile = getLogFile();
    Assert.isNotNull(logFile, "logFile");
    ILogResourceFactory factory = doGetLogResourceFactory();
    Assert.isNotNull(factory, "factory");
    ILogResource log = factory.createLogResource();
    log.setName(getLogFile().getName());
    log.setDialect(createLogDialect());
    try {
      log.configure(IHasEncoding.OPTION_ENCODING, encoding);
      log.configure(IHasLocale.OPTION_LOCALE, LocaleUtils.getLocaleId(locale));
      log.configure(IHasTimeZone.OPTION_TIMEZONE, timeZone.getID());
      doConfigure(log);
      // Create PK
      IndexPlugin.getDefault().getIndexService().createIndex(log);
      // That's it
      setIndexFile(IndexPlugin.getDefault().getIndexFile(log));
View Full Code Here

Examples of net.sf.logsaw.core.logresource.ILogResource

    cleanUp(false, true);
    File logFile = getLogFile();
    Assert.isNotNull(logFile, "logFile");
    ILogResourceFactory factory = doGetLogResourceFactory();
    Assert.isNotNull(factory, "factory");
    ILogResource log = factory.createLogResource();
    log.setName(getLogFile().getName());
    log.setDialect(createLogDialect());
    try {
      log.configure(IHasEncoding.OPTION_ENCODING, encoding);
      log.configure(IHasLocale.OPTION_LOCALE, LocaleUtils.getLocaleId(locale));
      log.configure(IHasTimeZone.OPTION_TIMEZONE, timeZone.getID());
      doConfigure(log);
      // That's it
      setLogResource(log);
    } catch (CoreException e) {
      logger.error(e.getLocalizedMessage(), e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.