Examples of ToolBarManager


Examples of org.eclipse.jface.action.ToolBarManager

    }

  }

  protected ToolBarManager createToolBarManager(Composite parent) {
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolBar = toolBarManager.createControl(parent);

    // Adapt it to a form if a form tool kit is specified
    adaptControl(toolBar);

    GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.BEGINNING).applyTo(toolBar);
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

    // in the given actionlist
    if (actions != null && actions.size() > 1) {

      final MenuManager viewMenuManager = new MenuManager();

      ToolBarManager manager = createToolBarManager(buttonComposite);
      toolBar = manager.getControl();

      viewMenuButton = new ToolItem(toolBar, SWT.PUSH, 0);

      viewMenuButton.setImage(CloudFoundryImages.getImage(CloudFoundryImages.MENU_VIEW_ENABLED));
      viewMenuButton.setDisabledImage(CloudFoundryImages.getImage(CloudFoundryImages.MENU_VIEW_DISABLED));
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);

    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.createControl(headerComposite);

    servicesViewer = new TableViewer(toolkit.createTable(client, SWT.MULTI));
    new ServiceViewerConfigurator().configureViewer(servicesViewer);

    servicesViewer.setContentProvider(new TreeContentProvider());
    servicesViewer.setLabelProvider(new ServicesTreeLabelProvider(servicesViewer) {

      protected Image getColumnImage(CloudService service, ServiceViewColumn column) {
        if (column == ServiceViewColumn.Tunnel) {
          TunnelBehaviour handler = new TunnelBehaviour(cloudServer);
          if (handler.hasCaldecottTunnel(service.getName())) {
            return CloudFoundryImages.getImage(CloudFoundryImages.CONNECT);
          }
        }
        return null;
      }

    });
    servicesViewer.setSorter(new ServiceViewerSorter(servicesViewer) {

      @Override
      protected int compare(CloudService service1, CloudService service2, ServiceViewColumn sortColumn) {
        if (sortColumn == ServiceViewColumn.Tunnel) {
          TunnelBehaviour handler = new TunnelBehaviour(cloudServer);
          if (handler.hasCaldecottTunnel(service1.getName())) {
            return -1;
          }
          else if (handler.hasCaldecottTunnel(service2.getName())) {
            return 1;
          }
          else {
            return 0;
          }
        }
        return super.compare(service1, service2, sortColumn);
      }

    });

    servicesViewer.setInput(new CloudService[0]);

    GridDataFactory.fillDefaults().grab(true, true).applyTo(servicesViewer.getControl());

    Action addServiceAction = new Action(Messages.COMMONTXT_ADD_SERVICE, CloudFoundryImages.NEW_SERVICE) {
      @Override
      public void run() {
        IWizard wizard = new CloudFoundryServiceWizard(cloudServer);
        WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard);
        dialog.setBlockOnOpen(true);
        dialog.open();
      }
    };
    toolBarManager.add(addServiceAction);
    toolBarManager.update(true);
    servicesSection.setTextClient(headerComposite);

    // create context menu
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);

    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.createControl(headerComposite);

    applicationsViewer = new TableViewer(toolkit.createTable(client, SWT.NONE));
    applicationsViewer.setContentProvider(new TreeContentProvider());
    applicationsViewer.setLabelProvider(new ServerLabelProvider() {
      @Override
      public Image getImage(Object element) {
        Image image = super.getImage(element);

        if (element instanceof IModule) {
          IModule module = (IModule) element;
          CloudFoundryApplicationModule appModule = editorPage.getCloudServer()
              .getExistingCloudModule(module);
          if (appModule != null && appModule.getErrorMessage() != null) {
            return CloudFoundryImages.getImage(new DecorationOverlayIcon(image,
                CloudFoundryImages.OVERLAY_ERROR, IDecoration.BOTTOM_LEFT));
          }
        }

        return image;
      }

      @Override
      public String getText(Object element) {
        // This is the WTP module name (usually, it's the workspace
        // project name)
        String moduleName = super.getText(element);

        // However, the user has the option to specify a different name
        // when pushing an app, which is used as the cf app name. If
        // they are different, and the
        // corresponding workspace project is accessible, show both.
        // Otherwise, show the cf app name.

        if (element instanceof IModule) {

          IModule module = (IModule) element;

          // Find the corresponding Cloud Foundry-aware application
          // Module.
          CloudFoundryApplicationModule appModule = cloudServer.getExistingCloudModule((IModule) element);

          if (appModule != null) {
            String cfAppName = appModule.getDeployedApplicationName();

            if (cfAppName != null) {

              // Be sure not to show a null WTP module name,
              // although
              // that should not be encountered
              if (moduleName != null
                  && !cfAppName.equals(moduleName)
                  && CloudFoundryProperties.isModuleProjectAccessible.testProperty(
                      new IModule[] { module }, cloudServer)) {
                moduleName = cfAppName + " (" + moduleName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
              }
              else {
                moduleName = cfAppName;
              }
            }
          }
        }

        return moduleName;
      }

    });
    applicationsViewer.setInput(new CloudApplication[0]);
    applicationsViewer.setSorter(new CloudFoundryViewerSorter());

    applicationsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        IModule module = (IModule) selection.getFirstElement();

        if (currentModule != module) {
          currentModule = module;
          getManagedForm().fireSelectionChanged(ApplicationMasterPart.this, selection);
        }
      }
    });
    GridDataFactory.fillDefaults().grab(true, true).hint(250, SWT.DEFAULT).applyTo(applicationsViewer.getControl());

    int ops = DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT;
    Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
    ApplicationViewersDropAdapter listener = new ApplicationViewersDropAdapter(applicationsViewer);
    applicationsViewer.addDropSupport(ops, transfers, listener);

    // create context menu
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener() {

      public void menuAboutToShow(IMenuManager manager) {
        fillApplicationsContextMenu(manager);
      }
    });

    Menu menu = menuManager.createContextMenu(applicationsViewer.getControl());
    applicationsViewer.getControl().setMenu(menu);
    editorPage.getSite().registerContextMenu(menuManager, applicationsViewer);

    Action addRemoveApplicationAction = new Action(Messages.ApplicationMasterPart_TEXT_ADD_REMOVE,
        ImageResource.getImageDescriptor(ImageResource.IMG_ETOOL_MODIFY_MODULES)) {
      @Override
      public void run() {
        ModifyModulesWizard wizard = new ModifyModulesWizard(cloudServer.getServerOriginal());
        WizardDialog dialog = new WizardDialog(getSection().getShell(), wizard);
        dialog.open();
      }
    };
    toolBarManager.add(addRemoveApplicationAction);

    // Fix for STS-2996. Moved from CloudFoundryApplicationsEditorPage
    toolBarManager.add(new RefreshApplicationEditorAction(editorPage));
    toolBarManager.update(true);
    section.setTextClient(headerComposite);

    getManagedForm().getToolkit().paintBordersFor(client);
  }
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

    }

    @Override
    protected IInformationControl doCreateInformationControl(final Shell parent) {
        if (BrowserInformationControl.isAvailable(parent)) {
            final ToolBarManager tbm = new ToolBarManager(SWT.FLAT);

            final String font = JFaceResources.DIALOG_FONT;
            final BrowserInformationControl control = new BrowserInformationControl(
                    parent, font, tbm);

            final PresenterControlCreator.BackAction backAction = new PresenterControlCreator.BackAction(
                    control);
            backAction.setEnabled(false);
            tbm.add(backAction);
            final PresenterControlCreator.ForwardAction forwardAction = new PresenterControlCreator.ForwardAction(
                    control);
            tbm.add(forwardAction);
            forwardAction.setEnabled(false);

            final PresenterControlCreator.ShowInEdocViewAction showInEdocViewAction = new PresenterControlCreator.ShowInEdocViewAction(
                    control);
            tbm.add(showInEdocViewAction);
            if (editor != null) {
                final OpenDeclarationAction openDeclarationAction = new OpenDeclarationAction(
                        control, editor);
                tbm.add(openDeclarationAction);

                final SimpleSelectionProvider selectionProvider = new SimpleSelectionProvider();
                final OpenEdocInExternalBrowserAction openEdocInExternalBrowserAction = new OpenEdocInExternalBrowserAction(
                        editor.getSite(), null);
                openEdocInExternalBrowserAction
                        .setSpecialSelectionProvider(selectionProvider);
                selectionProvider
                        .addSelectionChangedListener(openEdocInExternalBrowserAction);
                final ImageDescriptor descriptor = ErlideImage.OBJS_EXTERNALBROWSER
                        .getDescriptor();
                openEdocInExternalBrowserAction.setImageDescriptor(descriptor);
                openEdocInExternalBrowserAction.setDisabledImageDescriptor(descriptor);
                selectionProvider.setSelection(new StructuredSelection());
                tbm.add(openEdocInExternalBrowserAction);

                // OpenExternalBrowserAction openExternalJavadocAction = new
                // OpenExternalBrowserAction(
                // parent.getDisplay(), selectionProvider);
                // selectionProvider
                // .addSelectionChangedListener(openExternalJavadocAction);
                // selectionProvider.setSelection(new
                // StructuredSelection());
                // tbm.add(openExternalJavadocAction);

                final IInputChangedListener inputChangeListener = new IInputChangedListener() {
                    @Override
                    public void inputChanged(final Object newInput) {
                        backAction.update();
                        forwardAction.update();
                        if (newInput == null) {
                            selectionProvider.setSelection(new StructuredSelection());
                        } else if (newInput instanceof BrowserInformationControlInput) {
                            final BrowserInformationControlInput input = (BrowserInformationControlInput) newInput;
                            final Object inputElement = input.getInputElement();
                            selectionProvider.setSelection(new StructuredSelection(
                                    inputElement));
                            final boolean hasInputElement = inputElement != null;
                            showInEdocViewAction.setEnabled(hasInputElement);
                            openDeclarationAction.setEnabled(hasInputElement);
                            openEdocInExternalBrowserAction.setInput(newInput);
                            openEdocInExternalBrowserAction.setEnabled(hasInputElement);
                        }
                    }
                };
                control.addInputChangeListener(inputChangeListener);
            }
            tbm.update(true);

            control.addLocationListener(new HandleEdocLinksLocationListener(control));

            return control;
        }
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

     * @return a tool bar manager
     * @see ToolBarManager#ToolBarManager(int)
     * @see ToolBar for style bits
     */
    protected ToolBarManager createToolBarManager(int style) {
        return new ToolBarManager(style);
    }
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

    toolBar.setContextMenuManager(popUpMenu);

    toolBar.add(new GroupMarker("group.file"));

    {
      IToolBarManager toolBarX = new ToolBarManager();

      toolBarX.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));

      toolBarX.add(getAction(ActionFactory.SAVE.getId()));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));

      toolBarX.add(getAction(ActionFactory.PRINT.getId()));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));

      toolBarX.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
      toolBar.add(new ToolBarContributionItem(toolBarX,
          IWorkbenchActionConstants.TOOLBAR_FILE));
    }

    toolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));

    toolBar.add(new GroupMarker("group.nav"));

    toolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));

    toolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));

    {
      IToolBarManager toolBarX = new ToolBarManager();

      toolBarX.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));

      toolBarX.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
      toolBar.add(new ToolBarContributionItem(toolBarX,
          IWorkbenchActionConstants.TOOLBAR_HELP));
    }
  }
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

   
    ToolBar toolbar = new ToolBar(viewerPane, SWT.FLAT);
   
    viewerPane.setTopCenter(toolbar);

    ToolBarManager toolbarManager = new ToolBarManager(toolbar);
   
    if (toolbarControlCreator != null) {
      toolbarControlCreator.createToolbarControls(toolbarManager);
      toolbarManager.add(new Separator());
    }

    flatAction = new Action(Policy.bind("ResourceSelectionTree.flat"), Action.AS_RADIO_BUTTON) {  //$NON-NLS-1$
      public void run() {
        mode = MODE_FLAT;
        settings.put(MODE_SETTING, MODE_FLAT);
        treeAction.setChecked(false);
        compressedAction.setChecked(false);
        refresh();
      }     
    };
    flatAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_FLAT_MODE));
    toolbarManager.add(flatAction);
    treeAction = new Action(Policy.bind("ResourceSelectionTree.tree"), Action.AS_RADIO_BUTTON) {  //$NON-NLS-1$
      public void run() {
        mode = MODE_TREE;
        settings.put(MODE_SETTING, MODE_TREE);
        flatAction.setChecked(false);
        compressedAction.setChecked(false);
        refresh();
      }         
    };
    treeAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_TREE_MODE));
    toolbarManager.add(treeAction);
   
    compressedAction = new Action(Policy.bind("ResourceSelectionTree.compressedFolders"), Action.AS_RADIO_BUTTON) {  //$NON-NLS-1$
      public void run() {
        mode = MODE_COMPRESSED_FOLDERS;
        settings.put(MODE_SETTING, MODE_COMPRESSED_FOLDERS);
        treeAction.setChecked(false);
        flatAction.setChecked(false);
        refresh();
      }         
    };
    compressedAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_AFFECTED_PATHS_COMPRESSED_MODE));
    toolbarManager.add(compressedAction);
   
    toolbarManager.update(true);
   
    mode = MODE_COMPRESSED_FOLDERS;
    try {
      mode = settings.getInt(MODE_SETTING);
    } catch (Exception e) {}
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

            buttonGroupColumns = buttonGroupColumns + toolbarControlCreator.getControlCount();
        }
        ToolBar toolbar = new ToolBar(viewerPane, SWT.FLAT);
        viewerPane.setTopCenter(toolbar);

        ToolBarManager toolbarManager = new ToolBarManager(toolbar);

        if (toolbarControlCreator != null) {
            toolbarControlCreator.createToolbarControls(toolbarManager);
            toolbarManager.add(new Separator());
        }

        toolbarManager.update(true);

        resourceList = new ArrayList<IResource>();

        if (resources != null) {
            Arrays.sort(resources, comparator);
View Full Code Here

Examples of org.eclipse.jface.action.ToolBarManager

  private ToolBarManager manager;

  @Before
  public void before() {
    manager = new ToolBarManager(SWT.NONE);
    shell.getDisplay().syncExec(new Runnable() {
      @Override
      public void run() {
        manager.createControl(shell);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.