Beispiel #1
0
  private LabelProviderService getLabelProvider() {
    if (labelProviderService == null) {
      try {
        labelProviderService =
            ServiceUtilsForResourceSet.getInstance()
                .getService(LabelProviderService.class, adapter.getResourceSet());
      } catch (Exception e) {
        // Fine.  Create a local instance
        labelProviderService = new LabelProviderServiceImpl();
        localLabelProvider = true;
      }
    }

    return labelProviderService;
  }
Beispiel #2
0
  public void start(ModelSet modelsManager) {
    try {
      IEditorPart editor =
          ServiceUtilsForResourceSet.getInstance()
              .getService(IMultiDiagramEditor.class, modelsManager);

      if (editor != null) {
        // this model is opened in an editor. That is the context in which we want to provide our
        // services
        presenter = new ZombieStereotypeDialogPresenter(editor.getSite().getShell(), modelsManager);
        adapter.adapt(modelsManager);
      }
    } catch (ServiceException e) {
      // OK, there is no editor, so we aren't needed
    }
  }
Beispiel #3
0
  public void dispose(ModelSet modelsManager) {
    if (presenter != null) {
      presenter.dispose();
      presenter = null;
    }

    if (localLabelProvider) {
      try {
        labelProviderService.disposeService();
      } catch (ServiceException e) {
        Activator.log.error(e);
      } finally {
        labelProviderService = null;
        localLabelProvider = false;
      }
    }

    adapter.unadapt(modelsManager);
  }
Beispiel #4
0
 public static StereotypeApplicationRepairSnippet getInstance(ModelSet modelSet) {
   UMLResourceLoadAdapter adapter =
       (UMLResourceLoadAdapter)
           EcoreUtil.getExistingAdapter(modelSet, StereotypeApplicationRepairSnippet.class);
   return (adapter == null) ? null : adapter.getSnippet();
 }