Package org.eclipse.jface.action

Examples of org.eclipse.jface.action.ToolBarManager


    m.setCaption(f.getTitle());
    final ListEnumeratedValueSelector<Object> v = new ListEnumeratedValueSelector<Object>();
    m.add(new UniversalUIElement<ToolBar>(ToolBar.class, SWT.NONE) {

      protected ToolBar createControl(Composite conComposite) {
        ToolBarManager manager = new ToolBarManager();
        manager.add(new Action("New value") {
          {
            setImageDescriptor(AbstractUIPlugin
                .imageDescriptorFromPlugin(Activator.PLUGIN_ID,
                    "/icons/add_exc.gif"));
          }

          public void run() {
            if (f instanceof CGAEField) {
              CGAEField cgf = (CGAEField) f;
              BaseDataFacade fac = new BaseDataFacade(
                  cgf.keyKind, facade.getProject(), facade
                      .isDebug());
              fac.setNamespace(facade.getNamespace());
              DataStoreTableUI dstui = new DataStoreTableUI();
              dstui.setFacade(fac);
              Entity ent = new Entity(cgf.keyKind, e.getKey());
              Collection coll = ((Collection) ((HashMap) facade
                  .getChildren().get(cgf.getKeyKind())).get(e
                  .getKey()));
              if (coll != null && coll.size() != 0) {
                Entity old = (Entity) coll
                    .toArray(new Object[coll.size()])[coll
                    .size() - 1];
                for (Iterator<String> it = old.getProperties()
                    .keySet().iterator(); it.hasNext();) {
                  ent.setProperty(it.next(), "");
                }
              }
              ArrayList<Entity> select = new ArrayList();
              select.add(ent);
              fac.determineFields(select);
              // v.addValue(ent);
              dstui.open(ent, false, new IUpdateList() {

                public void update(Entity e) {
                  v.addValue(e);
                }
              });// ((Collection)((HashMap)facade.getChildren().get(cgf.getKeyKind())).get(e.getKey()));

            } else {
              Object firstElement = null;
              Binding bnd = new Binding(firstElement);
              bnd.setName("Edit");
              CompositeEditor m = new CompositeEditor(bnd);
              m.setLayoutManager(new HorizontalLayouter());
              TitledDialog dlg = new TitledDialog(m);
              GAEField singleField = fm.getSingleField();
              ApiProxy.setEnvironmentForCurrentThread(new FakeEnvironment(
                  e.getAppId()));
              Entity c = new Entity("A");

              if (fm instanceof CGAEField) {
                c = new Entity(fm.getKeyKind(), e.getKey());
                // Entity example =
              } else {
                c.setProperty(f.name, firstElement);
              }
              createBindings(c, m, bnd,
                  new Field[] { singleField }, facade);

              int open = dlg.open();
              if (open == Dialog.OK) {
                Object value = bnd.getBinding(f.name)
                    .getValue();
                if (value == null) {
                  value = new NullValue();
                }
                v.addValue(value);
              }
              bnd.dispose();

            }
          }
        });
        manager.add(new Action("Edit selected") {
          {
            setImageDescriptor(AbstractUIPlugin
                .imageDescriptorFromPlugin(Activator.PLUGIN_ID,
                    "/icons/text_edit.gif"));
          }

          public void run() {
            if (f instanceof CGAEField) {
              CGAEField cgf = (CGAEField) f;

              Object[] selected = v.getSelection().toArray();
              if (selected.length == 1) {
                BaseDataFacade fac = new BaseDataFacade(
                    cgf.keyKind, facade.getProject(),
                    facade.isDebug());
                fac.setNamespace(facade.getNamespace());
                DataStoreTableUI dstui = new DataStoreTableUI();
                final Entity sel = (Entity) selected[0];
                ArrayList<Entity> select = new ArrayList();
                select.add(sel);
                fac.determineFields(select);
                dstui.setFacade(fac);
                dstui.open(sel, false, new IUpdateList() {

                  public void update(Entity e) {
                    v.removeValue(sel);
                    v.addValue(e);
                  }
                });
              }
              return;
            } else {
              Object firstElement = v.getSelection()
                  .getFirstElement();
              Binding bnd = new Binding(firstElement);
              bnd.setName("Edit");
              CompositeEditor m = new CompositeEditor(bnd);
              TitledDialog dlg = new TitledDialog(m);
              GAEField singleField = fm.getSingleField();
              ApiProxy.setEnvironmentForCurrentThread(new FakeEnvironment(
                  e.getAppId()));
              Entity c = new Entity("A");
              if (firstElement instanceof NullValue) {
                c.setProperty(f.name, null);
              } else {
                c.setProperty(f.name, firstElement);
              }
              createBindings(c, m, bnd,
                  new Field[] { singleField }, facade);
              int open = dlg.open();
              if (open == Dialog.OK) {
                v.removeValue(firstElement);
                Object value = bnd.getBinding(f.name)
                    .getValue();
                if (value == null) {
                  value = new NullValue();
                }
                v.addValue(value);
              }
              bnd.dispose();
            }
          }
        });
        manager.add(new Action("Delete selected") {
          {
            setImageDescriptor(AbstractUIPlugin
                .imageDescriptorFromPlugin(Activator.PLUGIN_ID,
                    "/icons/delete.gif"));
          }

          @SuppressWarnings("unchecked")
          public void run() {
            final List selected = v.getSelection().toList();

            if (f instanceof CGAEField) {
              final CGAEField cgf = (CGAEField) f;
              BaseDataFacade fac = new BaseDataFacade(
                  cgf.keyKind, facade.getProject(), facade
                      .isDebug());
              fac.setNamespace(facade.getNamespace());
              fac.delete(selected.toArray(new Entity[selected
                  .size()]), new OperationCallback() {

                public void passed(Object object) {
                  Collection coll = (Collection) ((HashMap) facade
                      .getChildren()
                      .get(cgf.getKeyKind())).get(e
                      .getKey());
                  coll.removeAll(selected);
                  facade.updateChildren(e);
                  v.removeValues(selected);
                }

                public void failed(Exception exception) {
                  return;
                }
              });
              // facade.updateChildren(e);
            } else {
              v.removeValues(selected);
            }
          }
        });
        return manager.createControl(conComposite);
      }

    });

    v.setValueAsSelection(false);
View Full Code Here


                titledDialog.close();
              }

            };
            c.setLayout(new GridLayout(1, false));
            ToolBarManager man = new ToolBarManager();
            Action action = ui.createActions(man, false);
            man.createControl(c);

            GAEField d = (GAEField) f;
            if (d.keyKind == null) {
              final String[] kinds = new String[1];
              Binding bnd = new Binding("");
View Full Code Here

      layout.numColumns = 2;
      toolbarContainer.setLayout(layout);
      toolbarContainer.setLayoutData(new GridData(GridData.END, GridData.VERTICAL_ALIGN_BEGINNING, true, false));

      ToolBar tb = new ToolBar(toolbarContainer, SWT.FLAT | SWT.NO_BACKGROUND);
      fToolbarManager = new ToolBarManager(tb);
      tb.setLayoutData(new GridData(GridData.END, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
      tb = new ToolBar(toolbarContainer, SWT.FLAT | SWT.NO_BACKGROUND);
      fEditorManager = new ToolBarManager(tb);
      tb.setLayoutData(new GridData(GridData.END, GridData.VERTICAL_ALIGN_BEGINNING, true, false));
      fDesignContainer = container;
    }
    return container;
  }
View Full Code Here

    CoolBarManager coolBarManager = new CoolBarManager(style);
    coolBarManager.setLockLayout(false);               
    int toolBarStyle = SWT.FLAT | SWT.WRAP;

    /* Create "File" group */
    ToolBarManager toolBarManager = new ToolBarManager(toolBarStyle);
    ToolBarContributionItem toolItem = new ToolBarContributionItem(toolBarManager);

    ActionContributionItem newFileItem = new ActionContributionItem(events.newFileAct);
    ActionContributionItem openFileItem = new ActionContributionItem(events.openProblemAct);
    ActionContributionItem saveFileItem = new ActionContributionItem(events.saveProblemAct);

    toolBarManager.add(newFileItem);
    toolBarManager.add(openFileItem);
    toolBarManager.add(saveFileItem);
    coolBarManager.add(toolItem);

    /* Create "Solution" group */
    toolBarManager = new ToolBarManager(toolBarStyle);
    toolItem = new ToolBarContributionItem(toolBarManager);

    ActionContributionItem solveItem = new ActionContributionItem(events.solveProblemAct);

    toolBarManager.add(solveItem);
    coolBarManager.add(toolItem);

    return coolBarManager;
  }
View Full Code Here

    menuBar.add(helpMenu);
  }

  @Override
  protected void fillCoolBar(ICoolBarManager coolBar) {
    IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle());
    coolBar.add(toolbar);
    toolbar.add(saveAction);
    toolbar.add(ContributionItemFactory.NEW_WIZARD_SHORTLIST
        .create(getActionBarConfigurer().getWindowConfigurer().getWindow()));
    // allow contributions here with id "additions" (MB_ADDITIONS)
    coolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  }
View Full Code Here

     * Populates the Cool Bar
     */
    protected void fillCoolBar( ICoolBarManager coolBar )
    {
        // add main tool bar
        IToolBarManager toolbar = new ToolBarManager( SWT.FLAT | SWT.RIGHT );
        toolbar.add( newDropDownAction );
        toolbar.add( preferencesAction );
        coolBar.add( new ToolBarContributionItem( toolbar, Application.PLUGIN_ID + ".toolbar" ) ); //$NON-NLS-1$

        // add marker for additions
        coolBar.add( new GroupMarker( IWorkbenchActionConstants.MB_ADDITIONS ) );

        // add navigation tool bar
        // some actions are added from org.eclipse.ui.editor to the HISTORY_GROUP
        IToolBarManager navToolBar = new ToolBarManager( SWT.FLAT | SWT.RIGHT );
        navToolBar.add( new Separator( IWorkbenchActionConstants.HISTORY_GROUP ) );
        navToolBar.add( backwardHistoryAction );
        navToolBar.add( forwardHistoryAction );
        coolBar.add( new ToolBarContributionItem( navToolBar, IWorkbenchActionConstants.TOOLBAR_NAVIGATE ) );

    }
View Full Code Here

   * @param style the style
   * @return the toolbar manager
   */
  @Override
  protected ToolBarManager createToolBarManager(int style) {
    ToolBarManager toolBarManager = new ToolBarManager(style);
    return toolBarManager;
  }
View Full Code Here

        control.setTopLeft( connectionComboControl );

        // tool bar
        actionToolBar = new ToolBar( control, SWT.FLAT | SWT.RIGHT );
        actionToolBar.setLayoutData( new GridData( SWT.END, SWT.NONE, true, false ) );
        actionToolBarManager = new ToolBarManager( actionToolBar );
        control.setTopCenter( actionToolBar );

        // local menu
        control.setTopRight( null );
View Full Code Here

        control.setTopLeft( browserConnectionWidgetControl );

        // tool bar
        actionToolBar = new ToolBar( control, SWT.FLAT | SWT.RIGHT );
        actionToolBar.setLayoutData( new GridData( SWT.END, SWT.NONE, true, false ) );
        actionToolBarManager = new ToolBarManager( actionToolBar );
        control.setTopCenter( actionToolBar );

        // local menu
        control.setTopRight( null );
View Full Code Here

        control.setTopLeft( infoTextControl );

        // tool bar
        actionToolBar = new ToolBar( control, SWT.FLAT | SWT.RIGHT );
        actionToolBar.setLayoutData( new GridData( SWT.END, SWT.NONE, true, false ) );
        actionToolBarManager = new ToolBarManager( actionToolBar );
        control.setTopCenter( actionToolBar );

        // local menu
        this.menuManager = new MenuManager();
        menuToolBar = new ToolBar( control, SWT.FLAT | SWT.RIGHT );
View Full Code Here

TOP

Related Classes of org.eclipse.jface.action.ToolBarManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.