use of com.oxygenxml.git.editorvars.GitEditorVariablesResolver 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));
}
Aggregations