Exemplo n.º 1
1
  /**
   * Updates the element info to a change of the file content and sends out appropriate
   * notifications.
   *
   * @param fileEditorInput the input of an text editor
   */
  protected void handleElementContentChanged(IEditorInput fileEditorInput) {
    FileInfo info = (FileInfo) getElementInfo(fileEditorInput);
    if (info == null) {
      return;
    }

    IStorage storage = EditorUtils.getStorageFromInput(fileEditorInput);
    if (storage instanceof IFile) {
      IFile file = (IFile) storage;
      IDocument document = createEmptyDocument();
      IStatus status = null;

      try {

        try {
          refreshFile(file);
        } catch (CoreException x) {
          log.error("handleElementContentChanged", x);
        }

        setDocumentContent(document, file);
      } catch (CoreException x) {
        status = x.getStatus();
      }

      String newContent = document.get();

      if (!newContent.equals(info.fDocument.get())) {

        // set the new content and fire content related events
        fireElementContentAboutToBeReplaced(fileEditorInput);

        removeUnchangedElementListeners(fileEditorInput, info);

        info.fDocument.removeDocumentListener(info);
        info.fDocument.set(newContent);
        info.fCanBeSaved = false;
        info.modificationStamp = computeModificationStamp(file);
        info.fStatus = status;

        addUnchangedElementListeners(fileEditorInput, info);

        fireElementContentReplaced(fileEditorInput);

      } else {

        removeUnchangedElementListeners(fileEditorInput, info);

        // fires only the dirty state related event
        info.fCanBeSaved = false;
        info.modificationStamp = computeModificationStamp(file);
        info.fStatus = status;

        addUnchangedElementListeners(fileEditorInput, info);

        fireElementDirtyStateChanged(fileEditorInput, false);
      }
    }
  }
 @Override
 public void fetchRow(DBCSession session, DBCResultSet resultSet) throws DBCException {
   Object[] row = new Object[columnsCount];
   for (int i = 0; i < columnsCount; i++) {
     try {
       row[i] =
           metaColumns[i]
               .getValueHandler()
               .fetchValueObject(
                   session,
                   resultSet,
                   metaColumns[i].getAttribute(),
                   metaColumns[i].getOrdinalPosition());
     } catch (DBCException e) {
       // Do not reports the same error multiple times
       // There are a lot of error could occur during result set fetch
       // We report certain error only once
       List<DBCException> errorList = errors.get(metaColumns[i].getMetaAttribute());
       if (errorList == null) {
         errorList = new ArrayList<>();
         errors.put(metaColumns[i].getMetaAttribute(), errorList);
       }
       if (!errorList.contains(e)) {
         log.warn("Can't read column '" + metaColumns[i].getName() + "' value", e);
         errorList.add(e);
       }
     }
   }
   rows.add(row);
 }
Exemplo n.º 3
0
/** Data type resolver */
public class SQLDataTypeResolver extends TemplateVariableResolver {

  private static final Log log = Log.getLog(SQLDataTypeResolver.class);

  public SQLDataTypeResolver() {
    super("type", "Data type");
  }

  @Override
  protected String[] resolveAll(final TemplateContext context) {
    final DBCExecutionContext executionContext =
        ((DBPContextProvider) context).getExecutionContext();
    if (executionContext == null) {
      return super.resolveAll(context);
    }

    DBPDataTypeProvider dataTypeProvider =
        DBUtils.getAdapter(DBPDataTypeProvider.class, executionContext.getDataSource());
    if (dataTypeProvider != null) {
      final Collection<? extends DBSDataType> localDataTypes = dataTypeProvider.getLocalDataTypes();
      if (!CommonUtils.isEmpty(localDataTypes)) {
        String[] result = new String[localDataTypes.size()];
        int index = 0;
        for (DBSDataType dataType : localDataTypes) {
          result[index++] = dataType.getName();
        }
        return result;
      }
    }
    return super.resolveAll(context);
  }
}
  public static List<ERDEntity> generateEntityList(
      final EntityDiagram diagram, Collection<DBPNamedObject> objects) {
    final List<DBSObject> roots = new ArrayList<>();
    for (DBPNamedObject object : objects) {
      if (object instanceof DBSObject) {
        roots.add((DBSObject) object);
      }
    }

    final List<ERDEntity> entities = new ArrayList<>();

    try {
      DBeaverUI.runInProgressService(
          new DBRRunnableWithProgress() {
            @Override
            public void run(DBRProgressMonitor monitor)
                throws InvocationTargetException, InterruptedException {
              DiagramObjectCollector collector = new DiagramObjectCollector(diagram);
              try {
                collector.generateDiagramObjects(monitor, roots);
              } catch (DBException e) {
                throw new InvocationTargetException(e);
              }
              entities.addAll(collector.getDiagramEntities());
            }
          });
    } catch (InvocationTargetException e) {
      log.error(e.getTargetException());
    } catch (InterruptedException e) {
      // interrupted
    }
    return entities;
  }
Exemplo n.º 5
0
 @Override
 public void contributeProperties(
     @NotNull DBPPropertyManager propertySource, @NotNull IValueController controller) {
   super.contributeProperties(propertySource, controller);
   try {
     Object value = controller.getValue();
     if (value instanceof DBDContent) {
       propertySource.addProperty(
           PROP_CATEGORY_CONTENT,
           "content_type", //$NON-NLS-1$
           CoreMessages.model_jdbc_content_type,
           ((DBDContent) value).getContentType());
       final long contentLength = ((DBDContent) value).getContentLength();
       if (contentLength >= 0) {
         propertySource.addProperty(
             PROP_CATEGORY_CONTENT,
             "content_length", //$NON-NLS-1$
             CoreMessages.model_jdbc_content_length,
             contentLength);
       }
     }
   } catch (Exception e) {
     log.warn("Can't extract CONTENT value information", e); // $NON-NLS-1$
   }
 }
Exemplo n.º 6
0
 private void makeProposalsFromChildren(
     DBRProgressMonitor monitor,
     DBSObject parent,
     @Nullable String startPart,
     List<SQLCompletionProposal> proposals) {
   if (startPart != null) {
     startPart = wordDetector.removeQuotes(startPart).toUpperCase();
     int divPos = startPart.lastIndexOf(editor.getSyntaxManager().getStructSeparator());
     if (divPos != -1) {
       startPart = startPart.substring(divPos + 1);
     }
   }
   try {
     Collection<? extends DBSObject> children = null;
     if (parent instanceof DBSObjectContainer) {
       children = ((DBSObjectContainer) parent).getChildren(monitor);
     } else if (parent instanceof DBSEntity) {
       children = ((DBSEntity) parent).getAttributes(monitor);
     }
     if (children != null && !children.isEmpty()) {
       for (DBSObject child : children) {
         if (startPart != null && !child.getName().toUpperCase().startsWith(startPart)) {
           continue;
         }
         proposals.add(makeProposalsFromObject(monitor, child));
       }
     }
   } catch (DBException e) {
     log.error(e);
   }
 }
Exemplo n.º 7
0
/** Entity resolver */
public class SQLAttributeResolver extends TemplateVariableResolver {

  private static final Log log = Log.getLog(SQLAttributeResolver.class);

  public SQLAttributeResolver() {
    super("column", "Table column");
  }

  @Override
  protected String[] resolveAll(final TemplateContext context) {
    final DBCExecutionContext executionContext =
        ((DBPContextProvider) context).getExecutionContext();
    if (executionContext == null) {
      return super.resolveAll(context);
    }

    TemplateVariable tableVariable = ((SQLContext) context).getTemplateVariable("table");
    final String tableName = tableVariable == null ? null : tableVariable.getDefaultValue();
    if (!CommonUtils.isEmpty(tableName)) {
      final List<DBSEntityAttribute> attributes = new ArrayList<>();
      DBRRunnableWithProgress runnable =
          new DBRRunnableWithProgress() {
            @Override
            public void run(DBRProgressMonitor monitor)
                throws InvocationTargetException, InterruptedException {
              try {
                List<DBSEntity> entities = new ArrayList<>();
                SQLEntityResolver.resolveTables(monitor, executionContext, context, entities);
                if (!CommonUtils.isEmpty(entities)) {
                  DBSEntity table = DBUtils.findObject(entities, tableName);
                  if (table != null) {
                    attributes.addAll(CommonUtils.safeCollection(table.getAttributes(monitor)));
                  }
                }
              } catch (DBException e) {
                throw new InvocationTargetException(e);
              }
            }
          };
      RuntimeUtils.runTask(runnable, "Resolve attributes", 1000);
      if (!CommonUtils.isEmpty(attributes)) {
        String[] result = new String[attributes.size()];
        for (int i = 0; i < attributes.size(); i++) {
          DBSEntityAttribute entity = attributes.get(i);
          result[i] = entity.getName();
        }
        return result;
      }
    }
    return super.resolveAll(context);
  }

  @Override
  public void resolve(TemplateVariable variable, TemplateContext context) {
    super.resolve(variable, context);
    if (variable instanceof SQLVariable) {
      ((SQLVariable) variable).setResolver(this);
    }
  }
}
Exemplo n.º 8
0
 /**
  * Eclipse hack. Disables/enabled all key bindings in specified site's part. Works only if host
  * editor is extender of AbstractTextEditor Uses reflection because setActionActivation is private
  * method TODO: find better way to disable key bindings or prioritize event handling to widgets
  *
  * @param partSite workbench part site
  * @param enable enable or disable
  */
 @Deprecated
 public static void enableHostEditorKeyBindings(IWorkbenchPartSite partSite, boolean enable) {
   IWorkbenchPart part = partSite.getPart();
   if (part instanceof AbstractTextEditor) {
     AbstractTextEditor hostEditor = (AbstractTextEditor) part;
     if (hostEditor instanceof BaseTextEditor) {
       StyledText textWidget = ((BaseTextEditor) hostEditor).getTextViewer().getTextWidget();
       if (textWidget == null || textWidget.isDisposed()) {
         return;
       }
     }
     try {
       Method activatorMethod =
           AbstractTextEditor.class.getDeclaredMethod("setActionActivation", Boolean.TYPE);
       activatorMethod.setAccessible(true);
       activatorMethod.invoke(hostEditor, enable);
     } catch (Throwable e) {
       if (e instanceof InvocationTargetException) {
         e = ((InvocationTargetException) e).getTargetException();
       }
       log.warn("Can't disable text editor action activations", e);
     }
     // hostEditor.getEditorSite().getActionBarContributor().setActiveEditor(hostEditor);
   }
 }
  private void renderReport(DBRProgressMonitor monitor, CompareReport report) {
    try {
      File reportFile;
      switch (settings.getOutputType()) {
        case BROWSER:
          reportFile = File.createTempFile("compare-report", ".html");
          break;
        default:
          {
            StringBuilder fileName = new StringBuilder("compare"); // "compare-report.html";
            for (DBNDatabaseNode node : report.getNodes()) {
              fileName.append("-").append(CommonUtils.escapeIdentifier(node.getName()));
            }
            fileName.append("-report.html");
            reportFile = new File(settings.getOutputFolder(), fileName.toString());
            break;
          }
      }

      reportFile.deleteOnExit();
      OutputStream outputStream = new FileOutputStream(reportFile);
      try {
        monitor.beginTask("Render report", report.getReportLines().size());
        CompareReportRenderer reportRenderer = new CompareReportRenderer();
        reportRenderer.renderReport(monitor, report, getSettings(), outputStream);
        monitor.done();
      } finally {
        ContentUtils.close(outputStream);
      }
      UIUtils.launchProgram(reportFile.getAbsolutePath());
    } catch (IOException e) {
      showError(e.getMessage());
      log.error(e);
    }
  }
Exemplo n.º 10
0
 public static Combo createEncodingCombo(Composite parent, String curCharset) {
   if (curCharset == null) {
     curCharset = GeneralUtils.getDefaultFileEncoding();
   }
   Combo encodingCombo = new Combo(parent, SWT.DROP_DOWN);
   encodingCombo.setVisibleItemCount(30);
   SortedMap<String, Charset> charsetMap = Charset.availableCharsets();
   int index = 0;
   int defIndex = -1;
   for (String csName : charsetMap.keySet()) {
     Charset charset = charsetMap.get(csName);
     encodingCombo.add(charset.displayName());
     if (charset.displayName().equalsIgnoreCase(curCharset)) {
       defIndex = index;
     }
     if (defIndex < 0) {
       for (String alias : charset.aliases()) {
         if (alias.equalsIgnoreCase(curCharset)) {
           defIndex = index;
         }
       }
     }
     index++;
   }
   if (defIndex >= 0) {
     encodingCombo.select(defIndex);
   } else {
     log.warn("Charset '" + curCharset + "' is not recognized"); // $NON-NLS-1$ //$NON-NLS-2$
   }
   return encodingCombo;
 }
Exemplo n.º 11
0
  @Override
  protected ElementInfo createElementInfo(Object element) throws CoreException {
    if (element instanceof IEditorInput) {

      IEditorInput input = (IEditorInput) element;
      IStorage storage = EditorUtils.getStorageFromInput(input);
      if (storage instanceof IFile) {
        IFile file = (IFile) storage;
        try {
          refreshFile(file);
        } catch (CoreException x) {
          log.warn("Can't refresh file", x);
        }

        IDocument d;
        IStatus s = null;

        try {
          d = createDocument(element);
        } catch (CoreException x) {
          log.warn("Can't create document", x);
          s = x.getStatus();
          d = createEmptyDocument();
        }

        // Set the initial line delimiter
        String initialLineDelimiter = GeneralUtils.getDefaultLineSeparator();
        if (initialLineDelimiter != null) {
          ((IDocumentExtension4) d).setInitialLineDelimiter(initialLineDelimiter);
        }

        IAnnotationModel m = createAnnotationModel(element);
        FileSynchronizer f = new FileSynchronizer(input);
        f.install();

        FileInfo info = new FileInfo(d, m, f);
        info.modificationStamp = computeModificationStamp(file);
        info.fStatus = s;

        return info;
      }
    }

    return super.createElementInfo(element);
  }
Exemplo n.º 12
0
 public static void dispose(Resource resource) {
   if (resource != null && !resource.isDisposed()) {
     try {
       resource.dispose();
     } catch (Exception e) {
       log.debug("Resource dispose error", e);
     }
   }
 }
Exemplo n.º 13
0
 public static void dispose(Widget widget) {
   if (widget != null && !widget.isDisposed()) {
     try {
       widget.dispose();
     } catch (Exception e) {
       log.debug("widget dispose error", e);
     }
   }
 }
Exemplo n.º 14
0
 public static void addFocusTracker(
     IServiceLocator serviceLocator, String controlID, Control control) {
   final IFocusService focusService = serviceLocator.getService(IFocusService.class);
   if (focusService != null) {
     focusService.addFocusTracker(control, controlID);
   } else {
     log.debug("Focus service not found in " + serviceLocator);
   }
 }
Exemplo n.º 15
0
 PostgreTableBase findTable(DBRProgressMonitor monitor, long schemaId, long tableId)
     throws DBException {
   PostgreSchema schema = getSchema(monitor, schemaId);
   if (schema == null) {
     log.error("Catalog " + schemaId + " not found");
     return null;
   }
   return schema.getTable(monitor, tableId);
 }
Exemplo n.º 16
0
 @Override
 public List<DB2IndexColumn> getAttributeReferences(DBRProgressMonitor monitor) {
   try {
     return getContainer().getIndexCache().getChildren(monitor, getContainer(), this);
   } catch (DBException e) {
     // DF: Don't know what to do with this exception except log it
     LOG.error("DBException swallowed during getAttributeReferences", e);
     return null;
   }
 }
Exemplo n.º 17
0
 @Override
 public String getNodeDescription() {
   try {
     final IProject project = getProject();
     return project == null ? null : project.getDescription().getComment();
   } catch (CoreException e) {
     log.debug(e);
     return null;
   }
 }
Exemplo n.º 18
0
 public static void removeFocusTracker(IServiceLocator serviceLocator, Control control) {
   if (PlatformUI.getWorkbench().isClosing()) {
     // TODO: it is a bug in eclipse. During workbench shutdown disposed service returned.
     return;
   }
   final IFocusService focusService = serviceLocator.getService(IFocusService.class);
   if (focusService != null) {
     focusService.removeFocusTracker(control);
   } else {
     log.debug("Focus service not found in " + serviceLocator);
   }
 }
Exemplo n.º 19
0
 @Nullable
 public static Integer getTextInteger(Text text) {
   String str = text.getText();
   str = str.trim();
   if (str.length() == 0) {
     return null;
   }
   try {
     return Integer.valueOf(str);
   } catch (NumberFormatException e) {
     log.debug(e);
     return null;
   }
 }
Exemplo n.º 20
0
 private void addNodeSettings(DataTransferNodeDescriptor node) {
   if (node == null) {
     return;
   }
   Class<? extends IDataTransferNode> nodeClass = node.getNodeClass();
   if (nodeSettings.containsKey(nodeClass)) {
     return;
   }
   try {
     nodeSettings.put(nodeClass, new NodeSettings(node));
   } catch (DBException e) {
     log.error("Can't add node '" + node.getId() + "'", e);
   }
 }
Exemplo n.º 21
0
  static class LoadingUIJob<RESULT> extends AbstractUIJob {
    private static final Log log = Log.getLog(LoadingUIJob.class);

    private static final long DELAY = 200;

    private ILoadService<RESULT> loadService;
    private ILoadVisualizer<RESULT> visualizer;
    private DBRProgressMonitor mainMonitor;

    LoadingUIJob(LoadingJob<RESULT> loadingJob, DBRProgressMonitor mainMonitor) {
      super(loadingJob.getName());
      this.loadService = loadingJob.getLoadingService();
      this.visualizer = loadingJob.getVisualizer();
      this.mainMonitor = mainMonitor;
      setSystem(true);
    }

    @Override
    public IStatus runInUIThread(DBRProgressMonitor monitor) {
      /*
              if (mainMonitor.isCanceled()) {
                  // Try to cancel current load service
                  try {
                      loadService.cancel();
                  }
                  catch (InvocationTargetException e) {
                      log.warn("Error while canceling service", e.getTargetException());
                  }
                  return Status.CANCEL_STATUS;
              } else {
      */
      if (!visualizer.isCompleted()) {
        visualizer.visualizeLoading();
        schedule(DELAY);
      }
      // }
      return Status.OK_STATUS;
    }

    @Override
    public boolean belongsTo(Object family) {
      return family == LOADING_FAMILY;
    }

    @Override
    protected void canceling() {
      super.canceling();
    }
  }
Exemplo n.º 22
0
  private void closeStatement() {
    if (curStatement != null) {
      for (DBCResultSet resultSet : curResultSets) {
        resultSet.close();
      }
      curResultSets.clear();

      try {
        curStatement.close();
      } catch (Throwable e) {
        log.error("Error closing statement", e);
      }
      curStatement = null;
    }
  }
  private Boolean computeUserIsAuthorisedForDBCFG() {
    // Must have one of DATAACCESS, DBADM, SQLADM or or SELECT on SYSIBMADM.APPLICATIONS or CONTROL
    // on SYSIBMADM.APPLICATIONS
    if ((listAuthorities.contains(DATAACCESS))
        || (listAuthorities.contains(DBADM))
        || (listAuthorities.contains(SQLADM))) {
      return true;
    }
    if (listObjectPrivileges.contains(AUTH_DBCFG)) {
      return true;
    }

    LOG.debug("Current User is not authorized to see DB/DBM Configuration Parameters");
    return false;
  }
 private boolean matchesContentType(IResultSetContext context) {
   String documentType = context.getDocumentContentType();
   if (contentTypes.isEmpty() || CommonUtils.isEmpty(documentType)) {
     return false;
   }
   for (MimeType mimeType : contentTypes) {
     try {
       if (mimeType.match(documentType)) {
         return true;
       }
     } catch (MimeTypeParseException e) {
       log.warn("Bad document content type: " + documentType, e);
     }
   }
   return false;
 }
Exemplo n.º 25
0
  protected static List<DBNNode> loadTreeState(DBPPreferenceStore store, String propName) {
    final List<DBNNode> result = new ArrayList<>();
    final String sources = store.getString(propName);
    if (!CommonUtils.isEmpty(sources)) {
      try {
        DBeaverUI.runInProgressService(
            new DBRRunnableWithProgress() {
              @Override
              public void run(DBRProgressMonitor monitor) {
                // Keep broken datasources to make connect attempt only once
                Set<DBNDataSource> brokenDataSources = new HashSet<>();

                // Find all nodes
                StringTokenizer st = new StringTokenizer(sources, "|"); // $NON-NLS-1$
                while (st.hasMoreTokens()) {
                  String nodePath = st.nextToken();
                  try {
                    DBNDataSource dsNode =
                        DBeaverCore.getInstance().getNavigatorModel().getDataSourceByPath(nodePath);
                    if (brokenDataSources.contains(dsNode)) {
                      continue;
                    }

                    DBNNode node =
                        DBeaverCore.getInstance()
                            .getNavigatorModel()
                            .getNodeByPath(monitor, nodePath);
                    if (node != null) {
                      result.add(node);
                    } else {
                      brokenDataSources.add(dsNode);
                    }
                  } catch (DBException e) {
                    log.error(e);
                  }
                }
              }
            });
      } catch (InvocationTargetException e) {
        log.error(e.getTargetException());
      } catch (InterruptedException e) {
        // ignore
      }
    }
    return result;
  }
Exemplo n.º 26
0
  @Override
  public boolean performFinish() {
    // Save settings
    getSettings().saveTo(getDialogSettings());
    showError(null);

    // Compare
    final CompareObjectsExecutor executor = new CompareObjectsExecutor(settings);
    try {
      DBeaverUI.run(
          getContainer(),
          true,
          true,
          new DBRRunnableWithProgress() {
            @Override
            public void run(DBRProgressMonitor monitor)
                throws InvocationTargetException, InterruptedException {
              try {
                CompareReport report = generateReport(monitor, executor);

                renderReport(monitor, report);
              } catch (DBException e) {
                throw new InvocationTargetException(e);
              }
            }
          });
      UIUtils.showMessageBox(
          getShell(), "Objects compare", "Objects compare finished", SWT.ICON_INFORMATION);
    } catch (InvocationTargetException e) {
      if (executor.getInitializeError() != null) {
        showError(executor.getInitializeError().getMessage());
      } else {
        log.error(e.getTargetException());
        showError(e.getTargetException().getMessage());
      }
      return false;
    } catch (InterruptedException e) {
      showError("Compare interrupted");
      return false;
    } finally {
      executor.dispose();
    }

    // Done
    return true;
  }
Exemplo n.º 27
0
  public static void showErrorDialog(
      @Nullable Shell shell,
      @NotNull String title,
      @Nullable String message,
      @Nullable Throwable error) {
    if (error != null) {
      log.error(error);
    }

    showErrorDialog(
        shell,
        title,
        error == null ? null : message,
        error == null
            ? new Status(IStatus.ERROR, DBeaverCore.PLUGIN_ID, message)
            : GeneralUtils.makeExceptionStatus(error));
  }
Exemplo n.º 28
0
 public PostgreDataType getDataType(long typeId) {
   if (typeId <= 0) {
     return null;
   }
   PostgreDataType dataType = dataTypeCache.get(typeId);
   if (dataType != null) {
     return dataType;
   }
   for (PostgreSchema schema : getDatabase().schemaCache.getCachedObjects()) {
     dataType = schema.dataTypeCache.getDataType(typeId);
     if (dataType != null) {
       dataTypeCache.put(typeId, dataType);
       return dataType;
     }
   }
   log.debug("Data type '" + typeId + "' not found");
   return null;
 }
Exemplo n.º 29
0
  public PostgreDataType getDataType(String typeName) {
    if (typeName.endsWith("[]")) {
      // In some cases ResultSetMetadata returns it as []
      typeName = "_" + typeName.substring(0, typeName.length() - 2);
    }
    String alias = PostgreConstants.DATA_TYPE_ALIASES.get(typeName);
    if (alias != null) {
      typeName = alias;
    }
    {
      // First check system catalog
      final PostgreSchema schema = getCatalogSchema();
      if (schema != null) {
        final PostgreDataType dataType = schema.dataTypeCache.getCachedObject(typeName);
        if (dataType != null) {
          return dataType;
        }
      }
    }

    // Check schemas in search path
    final List<String> searchPath = dataSource.getSearchPath();
    for (String schemaName : searchPath) {
      final PostgreSchema schema = schemaCache.getCachedObject(schemaName);
      if (schema != null) {
        final PostgreDataType dataType = schema.dataTypeCache.getCachedObject(typeName);
        if (dataType != null) {
          return dataType;
        }
      }
    }
    // Check the rest
    for (PostgreSchema schema : schemaCache.getCachedObjects()) {
      if (searchPath.contains(schema.getName())) {
        continue;
      }
      final PostgreDataType dataType = schema.dataTypeCache.getCachedObject(typeName);
      if (dataType != null) {
        return dataType;
      }
    }
    log.debug("Data type '" + typeName + "' not found in database '" + getName() + "'");
    return null;
  }
Exemplo n.º 30
0
  private void dispose() {
    // this.trayItem.dispose();
    this.sharedTextColors.dispose();

    if (trayItem != null) {
      trayItem.hide();
    }

    List<IDisposable> dispList = new ArrayList<>(globalDisposables);
    Collections.reverse(dispList);
    for (IDisposable disp : dispList) {
      try {
        disp.dispose();
      } catch (Exception e) {
        log.error(e);
      }
      globalDisposables.remove(disp);
    }
  }