Ejemplo n.º 1
0
  /** @param parentShell */
  public CustomizeToolbarDialog(Shell parentShell) {
    super(parentShell);
    fResources = new LocalResourceManager(JFaceResources.getResources());
    fFirstTimeOpen =
        (Activator.getDefault().getDialogSettings().getSection(DIALOG_SETTINGS_KEY) == null);
    fPreferences = Owl.getPreferenceService().getGlobalScope();

    /* Colors */
    fSeparatorBorderFg = OwlUI.getColor(fResources, new RGB(210, 210, 210));
    fSeparatorBg = OwlUI.getColor(fResources, new RGB(240, 240, 240));
  }
Ejemplo n.º 2
0
  /*
   * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createButtonBar(Composite parent) {
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    Composite buttonBar = new Composite(parent, SWT.NONE);
    buttonBar.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    buttonBar.setLayout(layout);

    /* Info Container */
    Composite infoContainer = new Composite(buttonBar, SWT.None);
    infoContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    infoContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
    ((GridLayout) infoContainer.getLayout()).marginRight = 10;

    Label infoImg = new Label(infoContainer, SWT.NONE);
    infoImg.setImage(OwlUI.getImage(fResources, "icons/obj16/info.gif")); // $NON-NLS-1$
    infoImg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    Label infoText = new Label(infoContainer, SWT.WRAP);
    infoText.setText(Messages.CustomizeToolbarDialog_USE_MOUSE_INFO);
    infoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    applyDialogFont(infoContainer);

    /* Create Ok / Cancel Buttons */
    createButtonsForButtonBar(buttonBar);

    return buttonBar;
  }
  private void showMessage(String msg, boolean isError, boolean showProgress) {
    if (fBrowser.getControl().isDisposed()) return;

    StringBuilder html = new StringBuilder();
    html.append(
        "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"); //$NON-NLS-1$
    html.append("<html>\n"); // $NON-NLS-1$
    html.append("<body style=\"overflow: auto; font-family: ")
        .append(fNewsFontFamily)
        .append(",Verdanna,sans-serif; ")
        .append(fNormalFontCSS)
        .append("\">"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    if (showProgress)
      html.append(
          "<img src=\""
              + OwlUI.getImageUri("/icons/obj16/progress.gif", "progress.gif")
              + "\" />"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$

    if (isError) html.append("<span style=\"color: darkred;\">"); // $NON-NLS-1$
    else if (showProgress)
      html.append("<span style=\"padding-left:3px; vertical-align:top;\">"); // $NON-NLS-1$

    html.append(msg);

    if (isError || showProgress) html.append("</span>"); // $NON-NLS-1$

    html.append("</body>\n"); // $NON-NLS-1$
    html.append("</html>\n"); // $NON-NLS-1$

    fBrowser.getControl().setText(html.toString());
  }
Ejemplo n.º 4
0
 /*
  * @see org.eclipse.jface.dialogs.Dialog#close()
  */
 @Override
 public boolean close() {
   OwlUI.safeDispose(fAddMenu);
   fResources.dispose();
   if (!fOkPressed) {
     fPreferences.putIntegers(DefaultPreferences.TOOLBAR_ITEMS, fInitialToolBarItems);
     fPreferences.putInteger(DefaultPreferences.TOOLBAR_MODE, fInitialToolBarMode);
   }
   return super.close();
 }
  /* Init the Theme Font (from UI Thread) */
  private void createFonts() {
    int fontHeight = 10;
    Font newsFont = OwlUI.getThemeFont(OwlUI.NEWS_TEXT_FONT_ID, SWT.NORMAL);
    FontData[] fontData = newsFont.getFontData();
    if (fontData.length > 0) {
      fNewsFontFamily = fontData[0].getName();
      fontHeight = fontData[0].getHeight();
    }

    int normal = fontHeight;
    String fontUnit = "pt"; // $NON-NLS-1$
    fNormalFontCSS = "font-size: " + normal + fontUnit + ";"; // $NON-NLS-1$ //$NON-NLS-2$
  }
Ejemplo n.º 6
0
  /*
   * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {

    /* Composite to hold all components */
    Composite composite = new Composite((Composite) super.createDialogArea(parent), SWT.NONE);
    composite.setLayout(LayoutUtils.createGridLayout(1, 5, 10));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Title */
    setTitle(Messages.AggregateNewsDialog_AGGREGATE_NEWS);

    /* Title Image */
    setTitleImage(OwlUI.getImage(fResources, getTitleImage()));

    /* Title Message */
    setMessage(NLS.bind(Messages.AggregateNewsDialog_AGGREGATE_NEWS_OF_N, fFolderName));

    /* Dialog Message */
    Label dialogMessageLabel = new Label(composite, SWT.WRAP);
    dialogMessageLabel.setText(Messages.AggregateNewsDialog_AGGREGATION_RECOMMENDATION);
    dialogMessageLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Spacer */
    new Label(composite, SWT.NONE);

    /* Checkbox to disable confirm dialog */
    fRememberDecisionCheck = new Button(composite, SWT.CHECK);
    fRememberDecisionCheck.setText(Messages.AggregateNewsDialog_REMEMBER_DECISION);

    /* Holder for the separator to the OK and Cancel buttons */
    Composite sepHolder = new Composite(parent, SWT.NONE);
    sepHolder.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    sepHolder.setLayout(LayoutUtils.createGridLayout(1, 0, 0));

    /* Separator */
    Label separator = new Label(sepHolder, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    applyDialogFont(composite);

    return composite;
  }
Ejemplo n.º 7
0
  private Control createContentsSingleSearch(Composite parent) {
    ISearchMark mark = (ISearchMark) fEntities.get(0);
    Pair<ISearchCondition, List<ISearchCondition>> conditions =
        CoreUtils.splitScope(mark.getSearchConditions());

    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(2, 10, 10));

    /* Name */
    Label nameLabel = new Label(container, SWT.None);
    nameLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
    nameLabel.setText(Messages.SearchMarkPropertyPage_NAME);

    Composite nameContainer = new Composite(container, Application.IS_MAC ? SWT.NONE : SWT.BORDER);
    nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
    if (!Application.IS_MAC)
      nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    fNameInput = new Text(nameContainer, Application.IS_MAC ? SWT.BORDER : SWT.NONE);
    OwlUI.makeAccessible(fNameInput, nameLabel);
    fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    fNameInput.setText(mark.getName());

    ToolBar generateTitleBar = new ToolBar(nameContainer, SWT.FLAT);
    OwlUI.makeAccessible(generateTitleBar, Messages.SearchMarkPropertyPage_NAME_FROM_CONDITION);
    if (!Application.IS_MAC)
      generateTitleBar.setBackground(
          container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    ToolItem generateTitleItem = new ToolItem(generateTitleBar, SWT.PUSH);
    generateTitleItem.setImage(
        OwlUI.getImage(fSite.getResourceManager(), "icons/etool16/info.gif")); // $NON-NLS-1$
    generateTitleItem.setToolTipText(Messages.SearchMarkPropertyPage_NAME_FROM_CONDITION);
    generateTitleItem.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onGenerateName();
          }
        });

    /* Location */
    Label locationLabel = new Label(container, SWT.None);
    locationLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
    locationLabel.setText(Messages.SearchMarkPropertyPage_LOCATION);

    fFolderChooser = new FolderChooser(container, mark.getParent(), SWT.BORDER, true);
    fFolderChooser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fFolderChooser.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 2, 5, false));
    fFolderChooser.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    Composite topControlsContainer = new Composite(container, SWT.None);
    topControlsContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    topControlsContainer.setLayout(LayoutUtils.createGridLayout(4, 5, 0));
    ((GridLayout) topControlsContainer.getLayout()).marginTop = 10;

    fMatchAllRadio = new Button(topControlsContainer, SWT.RADIO);
    fMatchAllRadio.setText(Messages.SearchMarkPropertyPage_MATCH_ALL);
    fMatchAllRadio.setSelection(mark.matchAllConditions());

    fMatchAnyRadio = new Button(topControlsContainer, SWT.RADIO);
    fMatchAnyRadio.setText(Messages.SearchMarkPropertyPage_MATCH_ANY);
    fMatchAnyRadio.setSelection(!mark.matchAllConditions());

    /* Separator */
    Label sep = new Label(topControlsContainer, SWT.SEPARATOR | SWT.VERTICAL);
    sep.setLayoutData(new GridData(SWT.DEFAULT, 16));

    /* Scope */
    Composite scopeContainer = new Composite(topControlsContainer, SWT.None);
    scopeContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    scopeContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 0, 5, false));
    ((GridLayout) scopeContainer.getLayout()).marginLeft = 2;

    Label scopeLabel = new Label(scopeContainer, SWT.NONE);
    scopeLabel.setText(Messages.SearchMarkPropertyPage_SEARCH_IN);

    fLocationControl =
        new LocationControl(scopeContainer, SWT.WRAP) {
          @Override
          protected String getDefaultLabel() {
            return Messages.SearchMarkPropertyPage_ALL_NEWS;
          }
        };
    fLocationControl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    ((GridData) fLocationControl.getLayoutData()).widthHint = 100;
    fLocationControl.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 0, 0, false));

    if (conditions.getFirst() != null && conditions.getFirst().getValue() instanceof Long[][])
      fLocationControl.select((Long[][]) conditions.getFirst().getValue());

    Composite conditionsContainer = new Composite(container, SWT.BORDER);
    conditionsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    conditionsContainer.setLayout(LayoutUtils.createGridLayout(1));
    conditionsContainer.setBackground(
        container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    conditionsContainer.setBackgroundMode(SWT.INHERIT_FORCE);

    /* Search Conditions List */
    fSearchConditionList =
        new SearchConditionList(conditionsContainer, SWT.None, conditions.getSecond());
    fSearchConditionList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    if (conditions.getSecond().size() <= 3) fSearchConditionList.setVisibleItemCount(3);
    else // Workaround for Bug 1544: State Condition not enough width in propertes when scrollbar
         // showing
    fSearchConditionList.setVisibleItemCount(Math.min(7, conditions.getSecond().size()));

    if (CoreUtils.isLocationConflict(mark.getSearchConditions()))
      fSite.setMessage(
          Messages.SearchMarkPropertyPage_LOCATION_WARNING,
          IPropertyDialogSite.MessageType.WARNING);

    return container;
  }
Ejemplo n.º 8
0
  /*
   * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = createContainer(parent);

    Label infoLabel = new Label(container, SWT.None);
    infoLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1));
    infoLabel.setText(Messages.CustomizeToolbarDialog_DIALOG_INFO);

    /* Table showing Tool Items */
    Composite tableContainer = new Composite(container, SWT.NONE);
    tableContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    tableContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    CTable cTable = new CTable(tableContainer, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);

    fItemViewer = new TableViewer(cTable.getControl());
    fItemViewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fItemViewer.getTable().setHeaderVisible(false);
    ((GridData) fItemViewer.getTable().getLayoutData()).heightHint =
        fItemViewer.getTable().getItemHeight() * 24;
    fItemViewer.getTable().setFocus();
    fItemViewer
        .getTable()
        .setData(ApplicationWorkbenchWindowAdvisor.FOCUSLESS_SCROLL_HOOK, new Object());

    /* Custom Owner Drawn Category */
    if (!OwlUI.isHighContrast()) {
      fItemViewer
          .getControl()
          .addListener(
              SWT.EraseItem,
              new Listener() {
                public void handleEvent(Event event) {
                  ToolBarItem item = (ToolBarItem) event.item.getData();
                  if (item.item == CoolBarItem.SEPARATOR) {
                    Scrollable scrollable = (Scrollable) event.widget;
                    GC gc = event.gc;

                    Rectangle area = scrollable.getClientArea();
                    Rectangle rect = event.getBounds();

                    /* Paint the selection beyond the end of last column */
                    OwlUI.codExpandRegion(event, scrollable, gc, area);

                    /* Draw Gradient Rectangle */
                    Color oldForeground = gc.getForeground();
                    Color oldBackground = gc.getBackground();

                    /* Gradient */
                    gc.setBackground(fSeparatorBg);
                    gc.fillRectangle(0, rect.y, area.width, rect.height);

                    /* Top / Bottom Line */
                    gc.setForeground(fSeparatorBorderFg);
                    gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
                    gc.drawLine(0, rect.y, area.width, rect.y);

                    gc.setForeground(oldForeground);
                    gc.setBackground(oldBackground);

                    /* Mark as Background being handled */
                    event.detail &= ~SWT.BACKGROUND;
                  }
                }
              });
    }

    TableColumn nameCol = new TableColumn(fItemViewer.getTable(), SWT.NONE);

    CColumnLayoutData data = new CColumnLayoutData(Size.FILL, 100);
    cTable.manageColumn(
        nameCol, data, Messages.CustomizeToolbarDialog_VISIBLE_ITEMS, null, null, false, false);

    /* ContentProvider returns all selected Items */
    fItemViewer.setContentProvider(
        new IStructuredContentProvider() {
          public Object[] getElements(Object inputElement) {
            int[] itemIds = fPreferences.getIntegers(DefaultPreferences.TOOLBAR_ITEMS);
            ToolBarItem[] items = new ToolBarItem[itemIds.length];
            for (int i = 0; i < itemIds.length; i++) {
              items[i] = new ToolBarItem(CoolBarItem.values()[itemIds[i]]);
            }
            return items;
          }

          public void dispose() {}

          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
        });

    /* Label Provider */
    fItemViewer.setLabelProvider(
        new CellLabelProvider() {
          @Override
          public void update(ViewerCell cell) {
            CoolBarItem item = ((ToolBarItem) cell.getElement()).item;
            cell.setText(item.getName());

            if (item.getImg() != null) cell.setImage(fResources.createImage(item.getImg()));

            if (!OwlUI.isHighContrast() && item == CoolBarItem.SPACER)
              cell.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
          }
        });

    /* Selection */
    fItemViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            updateButtonEnablement();
          }
        });

    /* Support Keyboard Remove */
    fItemViewer
        .getTable()
        .addKeyListener(
            new KeyAdapter() {
              @Override
              public void keyPressed(KeyEvent e) {
                if (e.keyCode == SWT.DEL || (Application.IS_MAC && e.keyCode == SWT.BS)) onRemove();
              }
            });

    /* Drag Support */
    fItemViewer.addDragSupport(
        DND.DROP_MOVE,
        new Transfer[] {LocalSelectionTransfer.getTransfer()},
        new DragSourceAdapter() {
          @Override
          public void dragStart(final DragSourceEvent event) {
            SafeRunnable.run(
                new LoggingSafeRunnable() {
                  public void run() throws Exception {
                    IStructuredSelection selection =
                        (IStructuredSelection) fItemViewer.getSelection();
                    event.doit = (selection.size() < fItemViewer.getTable().getItemCount());

                    if (event.doit) {
                      LocalSelectionTransfer.getTransfer().setSelection(selection);
                      LocalSelectionTransfer.getTransfer()
                          .setSelectionSetTime(event.time & 0xFFFFFFFFL);
                    }
                    ;
                  }
                });
          }

          @Override
          public void dragSetData(final DragSourceEvent event) {
            SafeRunnable.run(
                new LoggingSafeRunnable() {
                  public void run() throws Exception {
                    if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType))
                      event.data = LocalSelectionTransfer.getTransfer().getSelection();
                  }
                });
          }

          @Override
          public void dragFinished(DragSourceEvent event) {
            SafeRunnable.run(
                new LoggingSafeRunnable() {
                  public void run() throws Exception {
                    LocalSelectionTransfer.getTransfer().setSelection(null);
                    LocalSelectionTransfer.getTransfer().setSelectionSetTime(0);
                  }
                });
          }
        });

    /* Drop Support */
    ViewerDropAdapter dropSupport =
        new ViewerDropAdapter(fItemViewer) {

          @Override
          public boolean validateDrop(Object target, int operation, TransferData transferType) {
            return true;
          }

          @Override
          public boolean performDrop(Object data) {
            ToolBarItem target = (ToolBarItem) getCurrentTarget();
            if (target != null) {
              onMove((StructuredSelection) data, target, getCurrentLocation());
              return true;
            }

            return false;
          }
        };
    dropSupport.setFeedbackEnabled(true);
    dropSupport.setScrollEnabled(true);
    dropSupport.setSelectionFeedbackEnabled(true);
    fItemViewer.addDropSupport(
        DND.DROP_MOVE, new Transfer[] {LocalSelectionTransfer.getTransfer()}, dropSupport);

    /* Set Dummy Input */
    fItemViewer.setInput(this);

    /* Container for the Buttons to Manage Providers */
    Composite buttonContainer = new Composite(container, SWT.None);
    buttonContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    buttonContainer.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false));

    /* Add */
    fAddMenu = new Menu(getShell(), SWT.POP_UP);
    fAddMenu.addMenuListener(
        new MenuListener() {
          public void menuShown(MenuEvent e) {
            MenuItem[] items = fAddMenu.getItems();
            for (MenuItem item : items) {
              item.dispose();
            }

            /* Fill not yet visible Items */
            int[] toolbarItemIds = fPreferences.getIntegers(DefaultPreferences.TOOLBAR_ITEMS);
            List<CoolBarItem> visibleItems = new ArrayList<CoolBarItem>();
            for (int toolbarItemId : toolbarItemIds) {
              visibleItems.add(CoolBarItem.values()[toolbarItemId]);
            }

            CoolBarItem[] toolItems = getSortedItems();
            int currentGroup = -1;
            for (final CoolBarItem toolItem : toolItems) {
              if (!visibleItems.contains(toolItem)
                  || toolItem == CoolBarItem.SEPARATOR
                  || toolItem == CoolBarItem.SPACER) {

                /* Divide Groups by Separators */
                if (currentGroup >= 0 && currentGroup != toolItem.getGroup())
                  new MenuItem(fAddMenu, SWT.SEPARATOR);

                /* Create Menu Item */
                MenuItem item = new MenuItem(fAddMenu, SWT.PUSH);
                if (StringUtils.isSet(toolItem.getTooltip())) item.setText(toolItem.getTooltip());
                else item.setText(toolItem.getName());
                if (toolItem.getImg() != null)
                  item.setImage(fResources.createImage(toolItem.getImg()));

                item.addSelectionListener(
                    new SelectionAdapter() {
                      @Override
                      public void widgetSelected(SelectionEvent e) {

                        /* Add Item */
                        onAdd(toolItem);

                        /* Re-Open Menu for More */
                        JobRunner.runInUIThread(
                            fAddMenu,
                            new Runnable() {
                              public void run() {
                                fAddMenu.setVisible(true);
                              };
                            });
                      }
                    });

                currentGroup = toolItem.getGroup();
              }
            }
          }

          public void menuHidden(MenuEvent e) {}
        });

    fAddButton = new Button(buttonContainer, SWT.DOWN);
    fAddButton.setText(Messages.CustomizeToolbarDialog_ADD);
    applyDialogFont(fAddButton);
    setButtonLayoutData(fAddButton);
    fAddButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            Rectangle rect = fAddButton.getBounds();
            Point pt = new Point(rect.x, rect.y + rect.height);
            pt = fAddButton.toDisplay(pt);
            fAddMenu.setLocation(pt.x, pt.y);
            fAddMenu.setVisible(true);
          }
        });

    /* Remove */
    fRemoveButton = new Button(buttonContainer, SWT.PUSH);
    fRemoveButton.setText(Messages.CustomizeToolbarDialog_REMOVE);
    fRemoveButton.setEnabled(false);
    applyDialogFont(fRemoveButton);
    setButtonLayoutData(fRemoveButton);
    fRemoveButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onRemove();
          }
        });

    /* Move Provider Up */
    fMoveUpButton = new Button(buttonContainer, SWT.PUSH);
    fMoveUpButton.setText(Messages.CustomizeToolbarDialog_MOVE_UP);
    fMoveUpButton.setEnabled(false);
    applyDialogFont(fMoveUpButton);
    setButtonLayoutData(fMoveUpButton);
    ((GridData) fMoveUpButton.getLayoutData()).verticalIndent = 10;
    fMoveUpButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onMove(true);
          }
        });

    /* Move Provider Down */
    fMoveDownButton = new Button(buttonContainer, SWT.PUSH);
    fMoveDownButton.setText(Messages.CustomizeToolbarDialog_MOVE_DOWN);
    fMoveDownButton.setEnabled(false);
    applyDialogFont(fMoveDownButton);
    setButtonLayoutData(fMoveDownButton);
    fMoveDownButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onMove(false);
          }
        });

    /* Restore Defaults */
    fRestoreDefaults = new Button(buttonContainer, SWT.PUSH);
    fRestoreDefaults.setText(Messages.CustomizeToolbarDialog_RESTORE_DEFAULTS);
    applyDialogFont(fRestoreDefaults);
    setButtonLayoutData(fRestoreDefaults);
    ((GridData) fRestoreDefaults.getLayoutData()).grabExcessVerticalSpace = true;
    ((GridData) fRestoreDefaults.getLayoutData()).verticalAlignment = SWT.END;
    fRestoreDefaults.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            onRestoreDefaults();
          }
        });

    /* Toolbar Mode */
    Composite modeContainer = new Composite(container, SWT.None);
    modeContainer.setLayout(LayoutUtils.createGridLayout(2, 5, 0));
    modeContainer.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, false, false, 2, 1));

    Label showLabel = new Label(modeContainer, SWT.NONE);
    showLabel.setText(Messages.CustomizeToolbarDialog_SHOW);

    fModeViewer = new ComboViewer(modeContainer, SWT.READ_ONLY | SWT.BORDER);
    fModeViewer.setContentProvider(new ArrayContentProvider());
    fModeViewer.setLabelProvider(
        new LabelProvider() {
          @Override
          public String getText(Object element) {
            if (element instanceof CoolBarMode) {
              switch ((CoolBarMode) element) {
                case IMAGE:
                  return Messages.CustomizeToolbarDialog_ICONS;
                case TEXT:
                  return Messages.CustomizeToolbarDialog_TEXT;
                case IMAGE_TEXT_VERTICAL:
                  return Messages.CustomizeToolbarDialog_ICONS_AND_TEXT;
                case IMAGE_TEXT_HORIZONTAL:
                  return Messages.CustomizeToolbarDialog_ICONS_AND_TEXT_SMALL;
              }
            }

            return super.getText(element);
          }
        });

    fModeViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
            CoolBarMode mode = (CoolBarMode) selection;
            fPreferences.putInteger(DefaultPreferences.TOOLBAR_MODE, mode.ordinal());
          }
        });

    fModeViewer.setInput(CoolBarAdvisor.CoolBarMode.values());
    fModeViewer.setSelection(
        new StructuredSelection(
            CoolBarMode.values()[fPreferences.getInteger(DefaultPreferences.TOOLBAR_MODE)]));

    /* Separator */
    new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL)
        .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    applyDialogFont(container);

    return container;
  }
  @Override
  protected Control createDialogArea(Composite parent) {

    /* Title */
    setTitle(Messages.GoogleCredentialDialog_TITLE);

    /* Title Image */
    setTitleImage(OwlUI.getImage(fResources, "icons/wizban/login_wiz.png")); // $NON-NLS-1$

    /* Title Message */
    setMessage(Messages.GoogleCredentialDialog_MESSAGE);

    /* Separator */
    new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL)
        .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Composite to hold all components */
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(LayoutUtils.createGridLayout(3, 5, 10));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    /* Label for username */
    Label userLabel = new Label(composite, SWT.WRAP);
    userLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    userLabel.setText(Messages.GoogleCredentialDialog_USERNAME);

    /* Field for username */
    Composite textIndent = new Composite(composite, SWT.NONE);
    textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    textIndent.setLayout(new GridLayout(1, false));

    /* Label for username */
    Label userSuggestLabel = new Label(composite, SWT.WRAP);
    userSuggestLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    userSuggestLabel.setText("@gmail.com"); // $NON-NLS-1$

    usernameField = new Text(textIndent, SWT.BORDER);
    usernameField.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    usernameField.setFocus();

    /* Label for password */
    Label passwordLabel = new Label(composite, SWT.WRAP);
    passwordLabel.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    passwordLabel.setText(Messages.GoogleCredentialDialog_PASSWORD);

    /* Field for password */
    Composite textIndent2 = new Composite(composite, SWT.NONE);
    textIndent2.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    textIndent2.setLayout(new GridLayout(1, false));

    passwordField = new Text(textIndent2, SWT.BORDER | SWT.PASSWORD);
    passwordField.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Separator */
    new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL)
        .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Try loading Credentials from Platform if available */
    preload();
    applyDialogFont(composite);
    return composite;
  }
 /*
  * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
  */
 public ImageDescriptor getImageDescriptor() {
   return OwlUI.getImageDescriptor("icons/eview16/webbrowser.gif"); // $NON-NLS-1$
 }