Add dialogs for element configurations

Create new plug-in project.

Create new class (for example LoginConfigurations) and make it extend CorePlugin.

Implement method run. This method must verify if the attribute is the desired and if it is return the new PropertyDescriptor as may be seen below for the Login configurations example:

public class LoginConfigurations extends CorePlugin{
   @Override
   public IPropertyDescriptor run() {
      if (pkg.getLogin_Entries().equals(feature)) {
         return new LoginEntryPropertyDescriptor(object, itemPropertyDescriptor);
      }
      else {
         return null;
      }
   }
}

IMPORTANT: Else with return null must always be present.

LoginEntryPropertyDescriptor is another class that must also be created (não com este nome, mas com outro que se entenda adequado). This class extends PropertyDescriptor and will be similar to:

public class LoginEntryPropertyDescriptor extends PropertyDescriptor {
   public LoginEntryPropertyDescriptor(Object object, IItemPropertyDescriptor itemPropertyDescriptor) {
      super(object, itemPropertyDescriptor);
   }
 
   @Override
   public CellEditor createPropertyEditor(Composite parent) {
      return new ExtendedDialogCellEditor(parent, getLabelProvider()) {
         @Override
         protected Object openDialogBox(Control cellEditorWindow) {
            // Here you are free to open a custom dialog that you have
            // created. In this example, we simply open an
            // ElementListSelectionDialog
 
            Login login = (Login) object;
            List<LoginEntry> list = login.getEntries();
 
            LoginEntriesDialog dialog = new LoginEntriesDialog(Display.getCurrent().getActiveShell(), list);
            dialog.create();
            int result = dialog.open();
            if(result == Window.OK && !dialog.getItems().isEmpty()){
               return dialog.getItems();
            }
            else if(result == Window.CANCEL && !dialog.getItems().isEmpty()){
               return list;
            }
            else{
               return new ArrayList<LoginEntry>();
            }
         }
      };
   }
}

Attention to the dialog creation in line:

LoginEntriesDialog dialog = new LoginEntriesDialog(Display.getCurrent().getActiveShell(), list);

This dialog must also be created by the developer, afterall, that is the goal, have a customized configuration dialog.

After creating all the neccessary classes, select project Paradigm.pluginLoader and the project recently created and in the context menu choose “export…” and next “Java→JAR File”.

After creating the Jar file, place it in the lib folder of Paradigm.edit.ui

Next, reference the Jar in the project, to do this:

The newly created configuration dialog is ready to use.

<< Script generation


Programmer manual