Search in sources :

Example 1 with ResolvingProxyDataFactory

use of com.oxygenxml.git.auth.ResolvingProxyDataFactory in project oxygen-git-client-addon by oxygenxml.

the class OxygenGitPluginExtension method applicationStarted.

/**
 * @see WorkspaceAccessPluginExtension#applicationStarted(StandalonePluginWorkspace)
 */
@Override
public void applicationStarted(final StandalonePluginWorkspace pluginWS) {
    this.pluginWorkspaceAccess = pluginWS;
    OptionsManager.getInstance().loadOptions(pluginWS.getOptionsStorage());
    gitRefreshSupport = new PanelRefresh(RemoteRepositoryChangeWatcher.createWatcher(pluginWS, gitController), () -> menuBar);
    final GitActionsManager gitActionsManager = new GitActionsManager(gitController, this, this, gitRefreshSupport);
    menuBar = new GitActionsMenuBar(gitActionsManager);
    pluginWS.addMenuBarCustomizer(menuBar);
    try {
        if (!"true".equals(System.getProperty(GitAddonSystemProperties.USE_JSCH_FOR_SSH_OPERATIONS))) {
            org.eclipse.jgit.transport.SshSessionFactory.setInstance(new org.eclipse.jgit.transport.sshd.SshdSessionFactory(null, new ResolvingProxyDataFactory()));
        }
        AuthenticationInterceptor.install();
        BlameManager.getInstance().install(gitController);
        // Add Git actions to the contextual menu of the Project view
        ProjectMenuGitActionsProvider projectMenuGitActionsProvider = new ProjectMenuGitActionsProvider(pluginWorkspaceAccess, gitController, OxygenGitPluginExtension.this);
        ProjectViewManager.addPopUpMenuCustomizer(projectMenuGitActionsProvider);
        // Add Git actions to the contextual menu of the current editor page
        pluginWorkspaceAccess.addMenusAndToolbarsContributorCustomizer(menusAndToolbarsCustomizer);
        // Customize the contributed side-views
        pluginWorkspaceAccess.addViewComponentCustomizer(viewInfo -> {
            // The constants' values are defined in plugin.xml
            if (GIT_STAGING_VIEW.equals(viewInfo.getViewID())) {
                customizeGitStagingView(viewInfo, gitActionsManager);
            } else if (GIT_HISTORY_VIEW.equals(viewInfo.getViewID())) {
                customizeHistoryView(viewInfo);
            } else if (GIT_BRANCH_VIEW.equals(viewInfo.getViewID())) {
                customizeBranchView(viewInfo);
            }
        });
        // Listens on the save event in the Oxygen editor and invalidates the cache.
        GitAccess.getInstance().getStatusCache().installEditorsHook(pluginWS);
        // Present the view to the user if it is the first run of the plugin
        final JFrame parentFrame = (JFrame) pluginWorkspaceAccess.getParentFrame();
        parentFrame.addComponentListener(new ComponentAdapter() {

            @Override
            public void componentShown(ComponentEvent e) {
                String key = "view.presented.on.first.run";
                String firstRun = pluginWorkspaceAccess.getOptionsStorage().getOption(key, null);
                if (firstRun == null) {
                    // This is the first run of the plugin.
                    pluginWorkspaceAccess.showView(GIT_STAGING_VIEW, false);
                    pluginWorkspaceAccess.getOptionsStorage().setOption(key, "true");
                }
            }
        });
        // Call the refresh command when the Oxygen window is activated
        parentFrame.addWindowListener(panelRefreshWindowListener);
        LoggingUtil.setupLogger();
    } catch (Throwable t) {
        // NOSONAR
        // Catch Throwable - Runtime exceptions shouldn't affect Oxygen.
        pluginWorkspaceAccess.showErrorMessage(t.getMessage());
        LOGGER.error(t.getMessage(), t);
    }
    UtilAccess utilAccess = PluginWorkspaceProvider.getPluginWorkspace().getUtilAccess();
    utilAccess.addCustomEditorVariablesResolver(new GitEditorVariablesResolver(gitController));
}
Also used : GitActionsMenuBar(com.oxygenxml.git.view.actions.GitActionsMenuBar) UtilAccess(ro.sync.exml.workspace.api.util.UtilAccess) GitActionsManager(com.oxygenxml.git.view.actions.GitActionsManager) GitEditorVariablesResolver(com.oxygenxml.git.editorvars.GitEditorVariablesResolver) PanelRefresh(com.oxygenxml.git.view.refresh.PanelRefresh) JFrame(javax.swing.JFrame) ComponentEvent(java.awt.event.ComponentEvent) ResolvingProxyDataFactory(com.oxygenxml.git.auth.ResolvingProxyDataFactory) ComponentAdapter(java.awt.event.ComponentAdapter)

Aggregations

ResolvingProxyDataFactory (com.oxygenxml.git.auth.ResolvingProxyDataFactory)1 GitEditorVariablesResolver (com.oxygenxml.git.editorvars.GitEditorVariablesResolver)1 GitActionsManager (com.oxygenxml.git.view.actions.GitActionsManager)1 GitActionsMenuBar (com.oxygenxml.git.view.actions.GitActionsMenuBar)1 PanelRefresh (com.oxygenxml.git.view.refresh.PanelRefresh)1 ComponentAdapter (java.awt.event.ComponentAdapter)1 ComponentEvent (java.awt.event.ComponentEvent)1 JFrame (javax.swing.JFrame)1 UtilAccess (ro.sync.exml.workspace.api.util.UtilAccess)1