Search in sources :

Example 1 with CustomRepositoryManager

use of org.knime.workbench.repository.model.CustomRepositoryManager in project knime-core by knime.

the class DefaultRepositoryView method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(final IViewSite site) throws PartInitException {
    super.init(site);
    m_manager = null;
    Location loc = Platform.getInstallLocation();
    if (loc == null) {
        LOGGER.error("Cannot detected KNIME installation directory");
        return;
    } else if (!loc.getURL().getProtocol().equals("file")) {
        LOGGER.error("KNIME installation directory is not local");
        return;
    }
    File instDir = new File(loc.getURL().getPath());
    File customDefinition = new File(instDir, DEFINITION_FILE);
    if (customDefinition.exists()) {
        try {
            m_manager = new CustomRepositoryManager(customDefinition);
            setPartName(m_manager.getCustomName());
        } catch (Exception ex) {
            throw new PartInitException("Could not load custom repository content", ex);
        }
    }
}
Also used : PartInitException(org.eclipse.ui.PartInitException) File(java.io.File) CustomRepositoryManager(org.knime.workbench.repository.model.CustomRepositoryManager) PartInitException(org.eclipse.ui.PartInitException) Location(org.eclipse.osgi.service.datalocation.Location)

Aggregations

File (java.io.File)1 Location (org.eclipse.osgi.service.datalocation.Location)1 PartInitException (org.eclipse.ui.PartInitException)1 CustomRepositoryManager (org.knime.workbench.repository.model.CustomRepositoryManager)1