コード例 #1
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.IPresentationPreview#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.ui.themes.ITheme)
   */
  public void createControl(Composite parent, ITheme currentTheme) {
    this.theme = currentTheme;
    folder = new CTabFolder(parent, SWT.BORDER);
    folder.setUnselectedCloseVisible(false);
    folder.setEnabled(false);
    folder.setMaximizeVisible(true);
    folder.setMinimizeVisible(true);

    viewForm = new ViewForm(folder, SWT.NONE);
    viewForm.marginHeight = 0;
    viewForm.marginWidth = 0;
    viewForm.verticalSpacing = 0;
    viewForm.setBorderVisible(false);
    toolBar = new ToolBar(viewForm, SWT.FLAT | SWT.WRAP);
    ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);

    Image hoverImage = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
    toolItem.setImage(hoverImage);

    viewForm.setTopRight(toolBar);

    viewMessage = new CLabel(viewForm, SWT.NONE);
    viewMessage.setText("Etu?"); // $NON-NLS-1$
    viewForm.setTopLeft(viewMessage);

    CTabItem item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Lorem"); // $NON-NLS-1$
    Label text = new Label(viewForm, SWT.NONE);
    viewForm.setContent(text);
    text.setText("Lorem ipsum dolor sit amet"); // $NON-NLS-1$
    text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Ipsum"); // $NON-NLS-1$
    item.setControl(viewForm);
    item.setImage(WorkbenchImages.getImage(ISharedImages.IMG_TOOL_COPY));

    folder.setSelection(item);

    item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Dolor"); // $NON-NLS-1$
    item = new CTabItem(folder, SWT.CLOSE);
    item.setText("Sit"); // $NON-NLS-1$

    currentTheme.addPropertyChangeListener(fontAndColorListener);
    setColorsAndFonts();
    setTabPosition();
    setTabStyle();
  }
コード例 #2
0
  public void createPartControl(Composite parent) {
    ViewForm topComp = new ViewForm(parent, SWT.NONE);
    topComp.setLayout(new FillLayout());
    createTableViewer(topComp);
    tv.setContentProvider(new SmsContentProvider());
    tv.setLabelProvider(new TableViewerLabelProvider());

    ArchiveRecentReadEditorActionGroup actionGroup = new ArchiveRecentReadEditorActionGroup(tv);
    ToolBar toolBar = new ToolBar(topComp, SWT.FLAT);
    ToolBarManager toolBarManager = new ToolBarManager(toolBar);
    actionGroup.fillActionToolBars(toolBarManager);

    topComp.setContent(tv.getControl());
    topComp.setTopLeft(toolBar);
    actionGroup.fireFirstAction();
  }
コード例 #3
0
  private void createMemoryBlocksTreeViewPane(Composite parent) {

    fMemBlkViewer = new MemoryBlocksTreeViewPane(this);
    fViewPanes.put(MemoryBlocksTreeViewPane.PANE_ID, fMemBlkViewer);
    ViewForm viewerViewForm = new ViewForm(parent, SWT.NONE);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(
            viewerViewForm, IDebugUIConstants.PLUGIN_ID + ".MemoryView_context"); // $NON-NLS-1$
    fViewPaneControls.put(MemoryBlocksTreeViewPane.PANE_ID, viewerViewForm);
    fWeights.add(Integer.valueOf(15));

    fMemBlkViewer.addSelectionListener(fSelectionProvider);

    Control viewerControl =
        fMemBlkViewer.createViewPane(
            viewerViewForm,
            MemoryBlocksTreeViewPane.PANE_ID,
            DebugUIMessages.MemoryView_Memory_monitors);
    viewerViewForm.setContent(viewerControl);

    ISelection selection = fMemBlkViewer.getSelectionProvider().getSelection();
    if (selection != null) fSelectionProvider.setSelection(selection);

    ToolBarManager viewerToolBarMgr = new ToolBarManager(SWT.FLAT);
    IAction[] actions = fMemBlkViewer.getActions();
    for (int i = 0; i < actions.length; i++) {
      viewerToolBarMgr.add(actions[i]);
    }
    ToolBar viewerToolbar = viewerToolBarMgr.createControl(viewerViewForm);
    viewerViewForm.setTopRight(viewerToolbar);

    Label viewerLabel = new Label(viewerViewForm, SWT.WRAP);
    viewerLabel.setText(DebugUIMessages.MemoryView_Memory_monitors);
    viewerViewForm.setTopLeft(viewerLabel);

    fMemBlkViewer
        .getControl()
        .addFocusListener(
            new FocusAdapter() {
              @Override
              public void focusGained(FocusEvent e) {
                fActivePaneId = fMemBlkViewer.getId();
              }
            });
  }
コード例 #4
0
ファイル: GridViewer.java プロジェクト: Tagin/aurora-ide
  public Composite createViewer(Composite parent) throws ApplicationException {

    container = createContainer(parent);
    filterText = createSerchBar();
    viewForm = createViewForm();
    toolBarManager = createToolBar();
    tableViewer = createTableViewer();

    if ((gridStyle & IGridViewer.NoToolBar) == 0) viewForm.setTopLeft(toolBarManager.getControl());
    viewForm.setContent(tableViewer.getControl());
    container.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            selection = beforeDispose();
          }
        });
    if (data != null) {
      setData(data);
    }
    return container;
  }
コード例 #5
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite theParent) {
    originalLanguageObjLabel =
        WidgetFactory.createLabel(theParent, CoreStringUtil.Constants.EMPTY_STRING);
    Composite pnlContents = (Composite) super.createDialogArea(theParent);

    //
    // main panel contents
    //

    CTabFolder tabFolder = WidgetFactory.createTabFolder(pnlContents);

    //
    // tabFolder contents - 2 tabs (Tree, SQL Text), each with a splitter
    //

    CTabItem treeTab =
        WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "treeTab")); // $NON-NLS-1$
    treeTab.setToolTipText(Util.getString(PREFIX + "treeTab.tip")); // $NON-NLS-1$

    SashForm treeTabSash = new SashForm(tabFolder, SWT.VERTICAL);
    treeTabSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    treeTab.setControl(treeTabSash);

    CTabItem sqlTab =
        WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "sqlTab")); // $NON-NLS-1$
    sqlTab.setToolTipText(Util.getString(PREFIX + "sqlTab.tip")); // $NON-NLS-1$

    SashForm sqlTabSash = new SashForm(tabFolder, SWT.VERTICAL);
    sqlTabSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    sqlTab.setControl(sqlTabSash);

    //
    // treeTab contents
    //

    ViewForm formTree = new ViewForm(treeTabSash, SWT.BORDER);
    Composite pnlTree = new Composite(formTree, SWT.NO_TRIM);
    formTree.setContent(pnlTree);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    pnlTree.setLayout(layout);
    pnlTree.setLayoutData(new GridData(GridData.FILL_BOTH));

    ViewForm formEditor = new ViewForm(treeTabSash, SWT.BORDER);
    pnlEditor = new Composite(formEditor, SWT.NO_TRIM);
    formEditor.setContent(pnlEditor);
    pnlEditor.setLayoutData(new GridData(GridData.FILL_BOTH));

    lblTitle = new Label(formEditor, SWT.CENTER);
    lblTitle.setBackground(BuilderUtils.COLOR_HIGHLIGHT);
    formEditor.setTopLeft(lblTitle);

    treeTabSash.setWeights(new int[] {30, 70});

    //
    // sqlTab contents
    //

    ViewForm formCurrentSql = new ViewForm(sqlTabSash, SWT.BORDER);
    ViewForm formOriginalSql = new ViewForm(sqlTabSash, SWT.BORDER);

    //
    // formCurrentSql contents
    //

    Composite pnlCurrentSql = new Composite(formCurrentSql, SWT.NONE);
    formCurrentSql.setContent(pnlCurrentSql);
    pnlCurrentSql.setLayout(new GridLayout());
    pnlCurrentSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    currentSql = new SqlDisplayPanel(pnlCurrentSql);
    currentSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    CLabel lblCurrent = new CLabel(formCurrentSql, SWT.NONE);
    lblCurrent.setBackground(BuilderUtils.COLOR_HIGHLIGHT);
    lblCurrent.setText(Util.getString(PREFIX + "lblCurrent")); // $NON-NLS-1$
    lblCurrent.setToolTipText(Util.getString(PREFIX + "lblCurrent.tip")); // $NON-NLS-1$
    formCurrentSql.setTopLeft(lblCurrent);

    //
    // formOriginalSql contents
    //

    Composite pnlOriginalSql = new Composite(formOriginalSql, SWT.NONE);
    formOriginalSql.setContent(pnlOriginalSql);
    pnlOriginalSql.setLayout(new GridLayout());
    pnlOriginalSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    originalSql = new SqlDisplayPanel(pnlOriginalSql);
    originalSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    CLabel lblOriginal = new CLabel(formOriginalSql, SWT.NONE);
    lblOriginal.setBackground(BuilderUtils.COLOR_HIGHLIGHT);
    lblOriginal.setText(Util.getString(PREFIX + "lblOriginal")); // $NON-NLS-1$
    lblOriginal.setToolTipText(Util.getString(PREFIX + "lblOriginal.tip")); // $NON-NLS-1$
    formOriginalSql.setTopLeft(lblOriginal);

    //
    // pnlTree contents - 2 columns (tree viewer, button panel)
    //

    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    pnlTree.setLayout(layout);

    treeViewer = new LanguageObjectBuilderTreeViewer(pnlTree);
    treeViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent theEvent) {
            handleTreeSelection();
          }
        });

    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(
        new IMenuListener() {
          @Override
          public void menuAboutToShow(IMenuManager theMenuMgr) {
            fillContextMenu(theMenuMgr);
          }
        });
    treeViewer.getTree().setMenu(menuMgr.createContextMenu(treeViewer.getTree()));

    Composite pnlButtons = new Composite(pnlTree, SWT.NONE);
    pnlButtons.setLayout(new GridLayout());

    createTreeButtons(pnlButtons);

    //
    // pnlEditor contents
    //

    layout = new GridLayout();
    layout.numColumns = 2;
    pnlEditor.setLayout(layout);

    pnlEditorDetail = new Composite(pnlEditor, SWT.NONE);
    pnlEditorDetail.setLayoutData(new GridData(GridData.FILL_BOTH));
    pnlEditorDetail.setLayout(new GridLayout());
    return pnlContents;
  }