Beispiel #1
0
  private void init(final CustomizationManager customizationManager) {
    // the appearance can be customized here:

    customizationManager.setShowDerivedLinks(true);

    try {

      // load customizations defined as default through the customization
      // extension
      List<MetamodelView> registryDefaultCustomizations =
          CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
      for (MetamodelView metamodelView : registryDefaultCustomizations) {
        customizationManager.registerCustomization(metamodelView);
      }
      customizationManager.loadCustomizations();
      loadFacetsForCustomizations(registryDefaultCustomizations, customizationManager);

    } catch (Throwable e) {
      Activator.getDefault()
          .getLog()
          .log(
              new Status(
                  IStatus.ERROR,
                  Activator.PLUGIN_ID,
                  "Error initializing customizations",
                  e)); //$NON-NLS-1$
    }
  }
  // TODO duplicate code from ModelExplorer
  // TODO vérifier que l'on n'a pas la même chose dans les tables également!
  @Override
  public void run() {
    final IEditorPart currentEditor = Utils.getCurrentEditor();
    final CustomizationManager customizationManager =
        Activator.getDefault().getCustomizationManager(currentEditor);
    final List<MetamodelView> initiallySelectedCustomizations =
        customizationManager.getRegisteredCustomizations();
    final LoadCustomizationsDialog loadCustomizationsDialog =
        new LoadCustomizationsDialog(
            Display.getCurrent().getActiveShell(),
            initiallySelectedCustomizations,
            this.registeredMetamodel);
    // TODO : override the dialog to hide the checkbox for the facet
    if (Window.OK == loadCustomizationsDialog.open()) {
      customizationManager.clearCustomizations();
      final List<MetamodelView> selectedCustomizations =
          loadCustomizationsDialog.getSelectedCustomizations();
      // before loading, clean all facet to prevent to let not interesting facets.
      customizationManager.clearFacets();
      if (loadCustomizationsDialog.isLoadRequiredFacetsSelected()) {
        // load facets corresponding to customizations
        // we ignore the facet in this dialog
      }
      for (final MetamodelView metamodelView : selectedCustomizations) {
        customizationManager.registerCustomization(metamodelView);
      }
      customizationManager.loadCustomizations();
    }
    // dialog.s

    // TODO
    // TODO Auto-generated method stub
    //	super.run();
  }
  private void init(final CustomizationManager customizationManager) {
    customizationManager.setShowContainer(false);
    customizationManager.setShowDerivedLinks(false);
    customizationManager.setShowEmptyLinks(false);

    try {
      List<MetamodelView> registryDefaultCustomizations =
          CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
      for (MetamodelView metamodelView : registryDefaultCustomizations) {
        customizationManager.registerCustomization(metamodelView);
      }

      customizationManager.loadCustomizations();
    } catch (Throwable e) {
      Activator.getDefault()
          .getLog()
          .log(
              new Status(
                  IStatus.ERROR,
                  Activator.PLUGIN_ID,
                  "Error initializing customizations",
                  e)); //$NON-NLS-1$
    }
  }