Exemplo n.º 1
0
 /** Updates the preference configuration */
 protected void updateExtendedEditorConfiguration() {
   String languagePreferred =
       Activator.getDefault()
           .getPreferenceStore()
           .getString(
               IDirectEditorsIds.EDITOR_FOR_ELEMENT
                   + resolveSemanticElement().eClass().getInstanceClassName());
   if (languagePreferred != configuration.getLanguage()) {
     configuration =
         DirectEditorsUtil.findEditorConfiguration(
             languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
   }
 }
Exemplo n.º 2
0
 /**
  * Updates the preference configuration
  *
  * @generated
  */
 protected void updateExtendedEditorConfiguration() {
   String languagePreferred =
       Activator.getDefault()
           .getPreferenceStore()
           .getString(
               IDirectEditorsIds.EDITOR_FOR_ELEMENT
                   + resolveSemanticElement().eClass().getInstanceClassName());
   if (languagePreferred != null
       && !languagePreferred.equals("")
       && !languagePreferred.equals(configuration.getLanguage())) {
     configuration =
         DirectEditorsUtil.findEditorConfiguration(
             languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
   } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
     configuration = null;
   }
 }
 /**
  * Initializes the extended editor configuration
  *
  * @generated
  */
 protected void initExtendedEditorConfiguration() {
   if (configuration == null) {
     final String languagePreferred =
         Activator.getDefault()
             .getPreferenceStore()
             .getString(
                 IDirectEditorsIds.EDITOR_FOR_ELEMENT
                     + resolveSemanticElement().eClass().getInstanceClassName());
     if (languagePreferred != null && !languagePreferred.equals("")) {
       configuration =
           DirectEditorsUtil.findEditorConfiguration(
               languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
     } else {
       configuration =
           DirectEditorsUtil.findEditorConfiguration(
               IDirectEditorsIds.UML_LANGUAGE,
               resolveSemanticElement().eClass().getInstanceClassName());
     }
   }
 }
  // TODO should be moved?
  private InformationItem createNewInformationItem() {
    // create the new InformationItem
    InformationItem infoItem = UMLFactory.eINSTANCE.createInformationItem();
    getContainer().getPackagedElements().add(infoItem);
    ElementInitializers.getInstance().init_InformationItem_2080(infoItem);

    // ask for the name of the new InformationItem
    // Create the editor
    Shell currentShell = new Shell(Display.getCurrent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    IDirectEditorConfiguration configuration; // = new DefaultDirectEditorConfiguration();
    String languagePreferred =
        Activator.getDefault()
            .getPreferenceStore()
            .getString(
                IDirectEditorsIds.EDITOR_FOR_ELEMENT + infoItem.eClass().getInstanceClassName());
    configuration =
        DirectEditorsUtil.findEditorConfiguration(
            languagePreferred, infoItem.eClass().getInstanceClassName());
    configuration.preEditAction(infoItem);
    configuration.setInputValidator(
        new NameLabelValidator(Messages.InformationItemGetNameDialog_Error_Message));
    ExtendedDirectEditionDialog dialog =
        new ExtendedDirectEditionDialog(currentShell, infoItem, infoItem.getName(), configuration);

    dialog.open();

    if (dialog.getReturnCode() == Window.CANCEL) {
      // We delete the newInformationItem
      int index = getContainer().getPackagedElements().indexOf(infoItem);
      getContainer().getPackagedElements().remove(index);
      return null;
    } else {
      infoItem.setName(dialog.getValue());
      ((CreateElementRequest) getRequest()).setNewElement(infoItem);
      return infoItem;
    }
  }