Crate an IntelliJ wizard plugin

Hello there, 

I am trying to create an IntelliJ wizard plugin, but I feel confused due to the fact, that I don't understand, which class should I use from com.intelij.ui.wizard. Therefore, I would like to check if I understand the concept correct or not? The scenario is as follows:

1: I would like to have a welcome screen that provides the user with two choices.

2: then, based on the user choice, I will populate different questions that I need to get the answer about it from the user. 

3. after filling the questions, I am going to add customized code to different part of the user application project. 

So, to do this, I should create 3 different forms (welcome, questions for the first choice, and questions for the second choice)? and then attach this content to the wizard, is that correct? 
Then, after the user clicks in the finish, I will need to make changes on the different part of the user application project (Android App). So, in this case, my question is that, can I call the wizard inside GenerateAction class by wrap it inside a generate dialogue, or I have to do it in another way?

if there is a sample code or plugin that I can inspire from, I will appreciate it

Thank you in advance

0
6 comments

I find most of my answers with regard to the previous questions, I would like to ask what should I do if I want to make some code inspections after the user clicks on the finish button. In general, I need to add some code in different part of the user application project. 

By the time I have addButtonAction, AddButtonWizard, and AddButtonWizardModel, that inside the addButtonAction I can call the wizard, but from here, I can not define the actions that I want to do after clicking the finish button. in general, I want to map the following code to be done by the wizard:
```

@Override
public void actionPerformed(AnActionEvent e) {
PsiClass psiclass = getPsiClassFromContext(e);
insertCodeHandler = new InsertCodeHandler(psiclass);
myProject = psiclass.getProject();
e.getPresentation().setEnabled(psiclass != null);
GenerateDialog dlg = new GenerateDialog (psiclass);
dlg.show();
if (!GenerateClass.INSTANCE.isHasTest() & !GenerateClass.INSTANCE.isHasRedirect()){
if (dlg.isOK()) {
Messages.showErrorDialog("Please complete the needed information ", "No Items Selected");
}
}
else {
if (dlg.isOK()) {
dlg.doValidate();
generateComparable(psiclass);
insertCodeHandler.invoke(myProject);
generateSupportiveClasses();
inspectBuildGradle();
}
}
}

```

0

You can take a look at com.intellij.codeInsight.generation.actions.GenerateEqualsAction & com.intellij.codeInsight.generation.ui.GenerateEqualsWizard and related classes.

0

The aforementioned classes are not available in the community version? because I could not find it there. 

0

They are in Community Repository, located under Java plugin

0

I have a general question. In the plugin that I developed, I help the developer to establish the authentication with different services. my question is that there are some parts that could be duplicated. In general, my question is, how can I implement a logic that makes the plugin aware of this different runing. because in the GUI, I will have different choices, so the developer can run multiple times the plugin and add the code related to the selected provider. in general, I need to add almost the same code, but by instantiating different class objects to call the same methods. to give you a general concept something similar to: 

```

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

mAuthStateManager = AuthStateManager.getInstance(this);
mConfiguration = Configuration.getInstance(this);
//new code for two button per login for the second run
authconfiguraion = ConfigurationAuth0.getInstance(this);
mAuthStateManager0 = AuthStateManager0.getInstance(this);
loginAuth = (Button) findViewById(R.id.login_Auth0);

// add after the second run
loginidp = (Button) findViewById(R.id.login_Idp);

//
loginAuth.setOnClickListener(new View.OnClickListener() {

// add after the second run@Override
public void onClick(View v) {
startAuth0();
}
});
loginidp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startAuth();
}
````

0

Sorry but this forum is about discussing development of plugins for IntelliJ platform only.

0

Please sign in to leave a comment.