Esempio n. 1
0
  private void createContents() {
    TabFolder tabFolder = new TabFolder(this, SWT.NONE);
    tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    CommonSelectorComposite commonCompositeRef =
        new CommonSelectorComposite(tabFolder, SWT.NONE, false, true);
    commonCompositeRef.getTreeViewer().getTree().setLinesVisible(false);
    commonCompositeRef.getTreeViewer().getTree().setHeaderVisible(false);
    commonCompositeRef.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    commonCompositeRef.setDataSet(this.dataset);
    commonCompositeRef.getTreeViewer().expandAll();
    TabItem tabItem1 = new TabItem(tabFolder, SWT.NONE);
    tabItem1.setText("Ref");
    tabItem1.setControl(commonCompositeRef);

    if (hasLabel) {
      CommonSelectorComposite commonCompositeLabel =
          new CommonSelectorComposite(tabFolder, SWT.NONE, false, true);
      commonCompositeLabel.getTreeViewer().getTree().setLinesVisible(false);
      commonCompositeLabel.getTreeViewer().getTree().setHeaderVisible(false);
      commonCompositeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
      commonCompositeLabel.setDataSet(this.dataset);
      commonCompositeLabel.getTreeViewer().expandAll();
      TabItem tabItem2 = new TabItem(tabFolder, SWT.NONE);
      tabItem2.setText("Label");
      tabItem2.setControl(commonCompositeLabel);
    }

    tabFolder.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent event) {
            selectedRef = "Ref".equals(((TabItem) event.item).getText());
          }

          public void widgetSelected(SelectionEvent event) {
            selectedRef = "Ref".equals(((TabItem) event.item).getText());
          }
        });

    Composite composite = new Composite(this, SWT.NONE);
    GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, false);

    composite.setLayoutData(gd_composite);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    composite.setLayout(gridLayout);

    Label label = new Label(composite, SWT.NONE);
    label.setText("属性值");
    displayText = new Text(composite, SWT.BORDER);
    displayText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    displayText.setEditable(false);
    displayText.setBackground(displayText.getParent().getBackground());

    displayText.setText(this.propertyItem.getValue());
  }
Esempio n. 2
0
  public void createWidgets(Composite c) {
    GridData gd;
    parentComposite = new Composite(c, SWT.NONE);
    parentComposite.setLayoutData(gd = new GridData(GridData.FILL_BOTH));
    gd.widthHint = 800;
    itabs.clear();
    if (!isSingle()) {
      parentComposite.setLayout(new FillLayout());
      folder = new TabFolder(parentComposite, SWT.NONE);
      //			folder.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY));
    }
    loadExtensionsSynchronized(parentComposite);

    // Set listener after data load, to avoid firing
    // selection event on not-initialized tab items
    if (folder != null) {
      folder.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
              if (folder.getSelection().length > 0) {
                updateSelectedTab();
              }
            }
          });
      if (folder.getItemCount() > 0) {
        int selectedTab = 0;
        Class<? extends ICPropertyTab> recentTab = recentTabs.get(getClass());
        if (recentTab != null) {
          TabItem[] tabs = folder.getItems();
          for (int i = 0; i < tabs.length; i++) {
            TabItem control = tabs[i];
            if (recentTab.isInstance(control.getData())) {
              selectedTab = i;
              break;
            }
          }
        }
        folder.setSelection(selectedTab);
        updateSelectedTab();
      }
    }
  }
    private void createParameterExceptionsFolder(Composite composite) {
      TabFolder folder = new TabFolder(composite, SWT.TOP);
      folder.setLayoutData(new GridData(GridData.FILL_BOTH));

      TabItem item = new TabItem(folder, SWT.NONE);
      item.setText(RefactoringMessages.ChangeSignatureInputPage_parameters);
      item.setControl(createParameterTableControl(folder));

      TabItem itemEx = new TabItem(folder, SWT.NONE);
      itemEx.setText(RefactoringMessages.ChangeSignatureInputPage_exceptions);
      itemEx.setControl(createExceptionsTableControl(folder));

      folder.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              ((TabItem) e.item).getControl().setFocus();
            }
          });
    }
  private void addListeners() {
    ModifyListener listener =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            validate();
          }
        };
    SelectionListener tabListener =
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }

          public void widgetSelected(SelectionEvent e) {
            TabItem[] tabs = folder.getSelection();

            if (tabs[0] == simpleItem) {
              nameText.setText(advancedNameText.getText());
              userNameText.setText(advancedUserNameText.getText());
              passwordText.setText(advancedPasswordText.getText());
            } else {
              advancedNameText.setText(nameText.getText());
              advancedUserNameText.setText(userNameText.getText());
              advancedPasswordText.setText(passwordText.getText());
            }
          }
        };
    nameText.addModifyListener(listener);
    hostText.addModifyListener(listener);
    portText.addModifyListener(listener);
    urlText.addModifyListener(listener);
    userNameText.addModifyListener(listener);
    passwordText.addModifyListener(listener);
    advancedNameText.addModifyListener(listener);
    advancedUserNameText.addModifyListener(listener);
    advancedPasswordText.addModifyListener(listener);
    folder.addSelectionListener(tabListener);
  }
  public void showAttributes(Composite parent) {
    composite = new Splitter(parent, SWT.HORIZONTAL);

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    composite.setLayout(layout);

    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);

    tabs = new TabFolder(composite, SWT.TOP);
    tabs.setLayoutData(data);
    general = new TabItem(tabs, SWT.NONE);

    general.setText(DropWizardMessages.General_Tab_Title);

    Composite generalTabContent = new Composite(tabs, SWT.NONE);

    general.setControl(fillGeneralOption(generalTabContent));

    TabItem advanced = new TabItem(tabs, SWT.NONE);
    advanced.setText(DropWizardMessages.Advanced_Tab_Title);
    TagAttributesComposite advancedTabContent =
        new TagAttributesComposite(tabs, SWT.NONE, getSpecificWizard().getWizardModel(), context);
    advanced.setControl(advancedTabContent);

    tabs.addSelectionListener(advancedTabContent);

    setControl(composite);
    getSpecificWizard()
        .getWizardModel()
        .addPropertyChangeListener(IDropWizardModel.TAG_PROPOSAL, this);
    updateTitle();
    runValidation();
  }
Esempio n. 6
0
  private Composite createRequestEditor(Composite parent) {
    final Composite rootControl = new Composite(parent, SWT.NONE);
    rootControl.setLayout(new FillLayout());

    requestTabFolder = new TabFolder(rootControl, SWT.TOP);

    requestTabItem = new TabItem(requestTabFolder, SWT.NONE);
    requestTabItem.setText("Request");
    requestEditor = new RequestEditor(requestTabFolder, requestBuilder);
    requestTabItem.setControl(requestEditor);
    requestTabItem.setData(requestEditor);

    requestHeaderTabItem = new TabItem(requestTabFolder, SWT.NONE);
    requestHeaderTabItem.setText("Headers");
    requestHeaderEditor = new HeaderEditor(requestTabFolder, requestBuilder, 0);
    requestHeaderTabItem.setControl(requestHeaderEditor);
    requestHeaderTabItem.setData(requestHeaderEditor);

    requestTabFolder.addSelectionListener(createRequestTabFolderSelectionListener());
    requestTabFolderItem = requestTabFolder.getSelection()[0];
    requestBuilderPartCurr = (IHttpBuilderPart) requestTabFolderItem.getData();

    return rootControl;
  }
  /** @see PreferencePage#createContents(Composite) */
  protected Control createContents(Composite parent) {
    final String MULTIPAGE_EDITOR_PAGE_DBSETTING =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.dbsetting");
    final String MULTIPAGE_EDITOR_PAGE_DBINTERFACE =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.dbinterface");
    final String MULTIPAGE_EDITOR_PAGE_DISPLAY =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.display");
    final String MULTIPAGE_EDITOR_PAGE_MODEL =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.model");
    final String MULTIPAGE_EDITOR_PAGE_MAPPING =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.mapping");
    final String MULTIPAGE_EDITOR_PAGE_DRIVER =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.driver");
    final String MULTIPAGE_EDITOR_PAGE_PREVIEW =
        DbfLauncherPlugin.getResourceString("multipage.editor.page.preview");
    DbfLauncherPlugin.log(
        IStatus.INFO,
        DbfLauncherPlugin.getResourceString("DbfProjectPropertyPage createContents new TabFolder"));

    folder = new TabFolder(parent, SWT.NONE);

    // folder.setLayout(new TabFolderLayout());
    folder.setLayoutData(new GridData(GridData.FILL_BOTH));
    // TODO findout why iprogressmonitor stuck property pages
    // iprogressmonitor = new ProgressMonitorPart(folder,
    // folder.getLayout());

    MyDefaultSelectionListener mydefaultselectionlistener = new MyDefaultSelectionListener();
    folder.addSelectionListener(mydefaultselectionlistener);

    // general property page
    generalPropertyPage = new DbfProjectGeneralPropertyPage(this);
    dbfProjectPropertyEditor = new DbfProjectPropertyEditor(this);
    // add to tab
    TabItem generalTab = new TabItem(folder, SWT.NONE);
    generalTab.setText(DbfPluginResources.PROPERTIES_PAGE_PROJECT_GENERAL_TAB_LABEL);
    generalTab.setControl(generalPropertyPage.createContents(folder));
    // add to tab
    TabItem dbSettingsTab = new TabItem(folder, SWT.NONE);
    dbSettingsTab.setText(MULTIPAGE_EDITOR_PAGE_DBSETTING);
    dbSettingsTab.setControl(dbfProjectPropertyEditor.createDBSettings(folder));
    // add to tab
    TabItem dbInterfaceSettingsTab = new TabItem(folder, SWT.NONE);
    dbInterfaceSettingsTab.setText(MULTIPAGE_EDITOR_PAGE_DBINTERFACE);
    dbInterfaceSettingsTab.setControl(dbfProjectPropertyEditor.createDbInterfaceSettings(folder));
    // add to tab
    TabItem displaySettingsTab = new TabItem(folder, SWT.NONE);
    displaySettingsTab.setText(MULTIPAGE_EDITOR_PAGE_DISPLAY);
    displaySettingsTab.setControl(dbfProjectPropertyEditor.createDisplaySettings(folder));
    // add to tab
    TabItem modelSettingsTab = new TabItem(folder, SWT.NONE);
    modelSettingsTab.setText(MULTIPAGE_EDITOR_PAGE_MODEL);
    modelSettingsTab.setControl(dbfProjectPropertyEditor.createModelSettings(folder));
    // add to tab
    TabItem dbMappingSettingsTab = new TabItem(folder, SWT.NONE);
    dbMappingSettingsTab.setText(MULTIPAGE_EDITOR_PAGE_MAPPING);
    dbMappingSettingsTab.setControl(dbfProjectPropertyEditor.createMappingSettings(folder));
    // add to tab
    TabItem dbDriverSettingsTab = new TabItem(folder, SWT.NONE);
    dbDriverSettingsTab.setText(MULTIPAGE_EDITOR_PAGE_DRIVER);
    dbDriverSettingsTab.setControl(dbfProjectPropertyEditor.createDriverSettings(folder));
    // add to tab
    TabItem dbPreviewTab = new TabItem(folder, SWT.NONE);
    dbPreviewTab.setText(MULTIPAGE_EDITOR_PAGE_PREVIEW);
    dbPreviewTab.setControl(dbfProjectPropertyEditor.createPreview(folder));

    return folder;
  }
Esempio n. 8
0
  /**
   * Creates all the tabs in the detail pane to display the information for a given node.
   *
   * @param composite
   * @param node
   */
  public static void createTabs(Composite composite, INode node) {

    List<IDetailTab> tabs = getTabs(node);

    if (tabs == null || tabs.size() == 0) {
      // no detail found..

      Label label = new Label(composite, SWT.FILL);
      label.setText(
          Messages.getString("DatabaseDetailView.Tab.Unavailable") + " " + node.getLabelText());
      label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

      return;
    }

    // create tabs
    TabFolder tabFolder = new TabFolder(composite, SWT.NULL);

    // only init tabs when the tab becomes active
    tabFolder.addSelectionListener(
        new SelectionListener() {

          public void widgetDefaultSelected(SelectionEvent e) {

            // noop
          }

          public void widgetSelected(SelectionEvent e) {

            TabItem tabItem = (TabItem) e.item;
            IDetailTab tab = (IDetailTab) tabItem.getData();
            if (tab != null) {

              // create composite on tab and fill it..
              Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL);
              tabItem.setControl(detailComposite);
              detailComposite.setLayout(new FillLayout());
              tab.fillComposite(detailComposite);
              detailComposite.layout();

              // store tab name, so we can reselect when other node is
              // chosen
              DetailTabManager.setActiveTabName(tabItem.getText());
            }
          }
        });

    // add tabs to folder
    int tabIndex = 0;
    for (IDetailTab detailTab : tabs) {

      // create tab
      TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
      tabItem.setText(detailTab.getLabelText());
      tabItem.setToolTipText(detailTab.getLabelToolTipText());

      // store tab so we can fill later
      tabItem.setData(detailTab);

      // reselect same tab as was previous selected
      if (tabItem.getText() != null && _activeTabName != null) {
        if (tabItem.getText().equals(_activeTabName)) {
          tabFolder.setSelection(tabIndex);
        }
      }

      tabIndex++;
    }

    // load data for active tab, default to first one if none is selected
    tabIndex = tabFolder.getSelectionIndex();
    if (tabIndex == -1) {
      tabIndex = 0;
    }

    TabItem tabItem = tabFolder.getItem(tabIndex);
    if (tabItem != null) {
      Composite detailComposite = new Composite(tabItem.getParent(), SWT.FILL);
      tabItem.setControl(detailComposite);
      detailComposite.setLayout(new FillLayout());
      IDetailTab tab = (IDetailTab) tabItem.getData();
      tab.fillComposite(detailComposite);
      detailComposite.layout();
    }

    tabFolder.layout();
  }
  /** {@inheritDoc} */
  public Control createContents(Composite parent) {

    Composite container = null;

    try {

      this.mPageController = new PageController();

      // suppress default- & apply-buttons
      noDefaultAndApplyButton();

      mMainTab = new TabFolder(parent, SWT.TOP);
      mMainTab.setLayoutData(new GridData(GridData.FILL_BOTH));
      mMainTab.addSelectionListener(mPageController);

      // create the main container
      container = new Composite(mMainTab, SWT.NULL);
      container.setLayout(new FormLayout());
      container.setLayoutData(new GridData(GridData.FILL_BOTH));

      // create the checkbox to enable/diable the simple configuration
      this.mChkSimpleConfig = new Button(container, SWT.CHECK);
      this.mChkSimpleConfig.setText(Messages.CheckstylePropertyPage_btnUseSimpleConfig);
      this.mChkSimpleConfig.addSelectionListener(this.mPageController);
      this.mChkSimpleConfig.setSelection(mProjectConfig.isUseSimpleConfig());

      FormData fd = new FormData();
      // fd.left = new FormAttachment(this.mChkEnable, 0, SWT.RIGHT);
      fd.top = new FormAttachment(0, 3);
      fd.right = new FormAttachment(100, -3);
      this.mChkSimpleConfig.setLayoutData(fd);

      // create the checkbox to enabel/disable checkstyle
      this.mChkEnable = new Button(container, SWT.CHECK);
      this.mChkEnable.setText(Messages.CheckstylePropertyPage_btnActivateCheckstyle);
      this.mChkEnable.addSelectionListener(this.mPageController);
      this.mChkEnable.setSelection(mCheckstyleInitiallyActivated);

      fd = new FormData();
      fd.left = new FormAttachment(0, 3);
      fd.top = new FormAttachment(0, 3);
      fd.right = new FormAttachment(this.mChkSimpleConfig, 3, SWT.LEFT);
      this.mChkEnable.setLayoutData(fd);

      // create the checkbox for formatter synching
      this.mChkSyncFormatter = new Button(container, SWT.CHECK);
      this.mChkSyncFormatter.setText(Messages.CheckstylePropertyPage_btnSyncFormatter);
      this.mChkSyncFormatter.addSelectionListener(this.mPageController);
      this.mChkSyncFormatter.setSelection(mProjectConfig.isSyncFormatter());

      fd = new FormData();
      fd.left = new FormAttachment(0, 3);
      fd.top = new FormAttachment(this.mChkEnable, 3, SWT.BOTTOM);
      this.mChkSyncFormatter.setLayoutData(fd);

      // create the configuration area
      mFileSetsContainer = new Composite(container, SWT.NULL);
      Control configArea = createFileSetsArea(mFileSetsContainer);
      fd = new FormData();
      fd.left = new FormAttachment(0, 3);
      fd.top = new FormAttachment(this.mChkSyncFormatter, 6, SWT.BOTTOM);
      fd.right = new FormAttachment(100, -3);
      fd.bottom = new FormAttachment(45);
      configArea.setLayoutData(fd);

      // create the filter area
      Control filterArea = createFilterArea(container);
      fd = new FormData();
      fd.left = new FormAttachment(0, 3);
      fd.top = new FormAttachment(configArea, 3, SWT.BOTTOM);
      fd.right = new FormAttachment(100, -3);
      fd.bottom = new FormAttachment(100, -3);
      fd.width = 500;
      filterArea.setLayoutData(fd);

      // create the local configurations area
      Control localConfigArea = createLocalConfigArea(mMainTab);

      TabItem mainItem = new TabItem(mMainTab, SWT.NULL);
      mainItem.setControl(container);
      mainItem.setText(Messages.CheckstylePropertyPage_tabMain);

      TabItem localItem = new TabItem(mMainTab, SWT.NULL);
      localItem.setControl(localConfigArea);
      localItem.setText(Messages.CheckstylePropertyPage_tabCheckConfigs);

    } catch (CheckstylePluginException e) {
      CheckstyleUIPlugin.errorDialog(getShell(), Messages.errorOpeningPropertiesPage, e, true);
    }

    return container;
  }
  protected Control createPageArea(Composite parent) {
    int numPages = fDescriptors.size();
    fScopeParts = new ScopePart[numPages];

    if (numPages == 0) {
      Label label = new Label(parent, SWT.CENTER | SWT.WRAP);
      label.setText(SearchMessages.SearchDialog_noSearchExtension);
      return label;
    }

    fCurrentIndex = getPreferredPageIndex();

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    TabFolder folder = new TabFolder(composite, SWT.NONE);
    folder.setLayout(new TabFolderLayout());
    folder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    folder.setFont(composite.getFont());

    for (int i = 0; i < numPages; i++) {
      SearchPageDescriptor descriptor = getDescriptorAt(i);
      if (WorkbenchActivityHelper.filterItem(descriptor)) continue;

      final TabItem item = new TabItem(folder, SWT.NONE);
      item.setData("descriptor", descriptor); // $NON-NLS-1$
      item.setText(descriptor.getLabel());
      item.addDisposeListener(
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent e) {
              item.setData("descriptor", null); // $NON-NLS-1$
              if (item.getImage() != null) item.getImage().dispose();
            }
          });
      ImageDescriptor imageDesc = descriptor.getImage();
      if (imageDesc != null) item.setImage(imageDesc.createImage());

      if (i == fCurrentIndex) {
        Control pageControl = createPageControl(folder, descriptor);
        pageControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        item.setControl(pageControl);
        fCurrentPage = descriptor.getPage();
        fDialogSettings.put(STORE_PREVIOUS_PAGE, descriptor.getId());
      }
    }

    folder.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            turnToPage(event);
          }
        });

    folder.setSelection(fCurrentIndex);

    return composite;
  }