コード例 #1
0
  /**
   * This creates a model editor.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated NOT
   */
  public GenfwEditor() {
    super();

    // Create an adapter factory that yields item providers.
    //
    Registry regsitry = EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry();
    adapterFactory = new ComposedAdapterFactory(regsitry);

    // Create the command stack that will notify this editor as commands are executed.
    //
    BasicCommandStack commandStack = new BasicCommandStack();

    // Add a listener to set the most recent command's affected objects to be the selection of the
    // viewer with focus.
    //
    commandStack.addCommandStackListener(
        new CommandStackListener() {
          public void commandStackChanged(final EventObject event) {
            getContainer()
                .getDisplay()
                .asyncExec(
                    new Runnable() {
                      public void run() {
                        firePropertyChange(IEditorPart.PROP_DIRTY);

                        // Try to select the affected objects.
                        //
                        Command mostRecentCommand =
                            ((CommandStack) event.getSource()).getMostRecentCommand();
                        if (mostRecentCommand != null) {
                          setSelectionToViewer(mostRecentCommand.getAffectedObjects());
                        }
                        if (propertySheetPage != null) {
                          propertySheetPage.refresh();
                        }
                      }
                    });
          }
        });

    // Create the editing domain with a special command stack.
    //
    editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap());
  }
コード例 #2
0
ファイル: Activator.java プロジェクト: go2zo/nuclear-bomb
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
  * )
  */
 public void start(BundleContext context) throws Exception {
   super.start(context);
   plugin = this;
   log = new LogHelper(plugin);
   EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry();
 }