Need help with my plugin: no component in default project: ...

My plugin implement  AbstractVcs

When trying to open settings from the default project, I got the message in log and settings is not opened.

  ...[1305352]   INFO - ifecycle.PeriodicalTasksCloser - no component in default project: wfplugins.wfclearcase.ClearCaseVCS

(It does work correctly when opennig from non default project).

The messaged is loged by the code:

public <T> T safeGetComponent(@NotNull final Project project, final Class<T> componentClass) throws ProcessCanceledException {


    T component = null;
    try {
      component = project.getComponent(componentClass);
    }
    catch (NullPointerException e) {
      throwCanceledException(project, e);
    } catch (AssertionError e) {
      throwCanceledException(project, e);
    }
    if (component == null) {
      if (project.isDefault()) {
        LOG.info("no component in default project: " + componentClass.getName());
      }
      throwCanceledException(project, new NullPointerException());
    }
    return component;
  }


A partial stack trace:

AWT-EventQueue-1 11.1.1#IC-117.117, eap:false@1477, prio=6, in group 'Idea Thread Group', status: 'RUNNING'
      at com.intellij.lifecycle.PeriodicalTasksCloser.safeGetComponent(PeriodicalTasksCloser.java:61)
      at com.intellij.openapi.vcs.impl.VcsEP.getVcs(VcsEP.java:56)
      at com.intellij.openapi.vcs.impl.projectlevelman.AllVcses.getByName(AllVcses.java:96)
      at com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl.findVcsByName(ProjectLevelVcsManagerImpl.java:173)
      at com.intellij.openapi.vcs.configurable.VcsManagerConfigurable.createVcsConfigurableWrapper(VcsManagerConfigurable.java:160)
      at com.intellij.openapi.vcs.configurable.VcsManagerConfigurable.buildConfigurables(VcsManagerConfigurable.java:143)
      at com.intellij.openapi.options.SearchableConfigurable$Parent$Abstract.getConfigurables(SearchableConfigurable.java:76)
      at com.intellij.openapi.options.newEditor.OptionsTree.buildChildren(OptionsTree.java:504)
      at com.intellij.openapi.options.newEditor.OptionsTree.access$500(OptionsTree.java:56)
      at com.intellij.openapi.options.newEditor.OptionsTree$EditorNode.buildChildren(OptionsTree.java:534)
      at com.intellij.openapi.options.newEditor.OptionsTree$EditorNode.buildChildren(OptionsTree.java:521)
      at com.intellij.ui.treeStructure.CachingSimpleNode.getChildren(CachingSimpleNode.java:36)
      at com.intellij.ui.treeStructure.SimpleTreeStructure.getChildElements(SimpleTreeStructure.java:25)
      at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:64)
      at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.addToCache(FilteringTreeStructure.java:75)
      at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.rebuild(FilteringTreeStructure.java:59)
      at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.<init>(FilteringTreeStructure.java:51)
      at com.intellij.ui.treeStructure.filtered.FilteringTreeStructure.<init>(FilteringTreeStructure.java:42)
      at com.intellij.ui.treeStructure.filtered.FilteringTreeBuilder.<init>(FilteringTreeBuilder.java:52)
      at com.intellij.openapi.options.newEditor.OptionsTree$MyBuilder.<init>(OptionsTree.java:759)
      at com.intellij.openapi.options.newEditor.OptionsTree.<init>(OptionsTree.java:92)
      at com.intellij.openapi.options.newEditor.OptionsEditor$3.<init>(OptionsEditor.java:143)
      at com.intellij.openapi.options.newEditor.OptionsEditor.<init>(OptionsEditor.java:143)
      at com.intellij.openapi.options.newEditor.OptionsEditorDialog.createCenterPanel(OptionsEditorDialog.java:88)
      at com.intellij.openapi.ui.DialogWrapper.init(DialogWrapper.java:1084)
      at com.intellij.openapi.options.newEditor.OptionsEditorDialog.init(OptionsEditorDialog.java:72)
      at com.intellij.openapi.options.newEditor.OptionsEditorDialog.<init>(OptionsEditorDialog.java:57)
      at com.intellij.ide.actions.ShowSettingsUtilImpl._showSettingsDialog(ShowSettingsUtilImpl.java:67)
      at com.intellij.ide.actions.ShowSettingsUtilImpl.showSettingsDialog(ShowSettingsUtilImpl.java:49)
      at com.intellij.ide.actions.ShowSettingsAction.actionPerformed(ShowSettingsAction.java:63)


Thank in advance.
Boaz

2 comments
Comment actions Permalink

How is your VCS class registered in plugin.xml? If you use the <vcs> extension point, things should just work.

0
Comment actions Permalink

Thank for your reply.
I check what you told me.
My VCS was registered twice onec in <project-components> and once in  <extensions>:


Now that I removed the registration in <project-components>, then the above bug was solved, Just that now many of my project-component need to be changed to projectService

I know that this not the place to get a 'lesson', But can you give a link that explain when should I use project-component and when projectService. It quite new to me (I wrote the plugin-in in ItelliJ 5 :) )

Many Thanks
Boaz

0

Please sign in to leave a comment.