コード例 #1
0
 /**
  * @param aContentService
  * @param descriptor
  * @return True if the descriptor is visible to the given content service.
  */
 private boolean isVisible(
     INavigatorContentService aContentService, CommonWizardDescriptor descriptor) {
   return !WorkbenchActivityHelper.filterItem(descriptor)
       && (aContentService == null
           || (descriptor.getId() == null
               || (aContentService.isVisible(descriptor.getId())
                   && aContentService.isActive(descriptor.getId()))));
 }
コード例 #2
0
 /**
  * Differs from super implementation in that if the node is found but should be filtered based on
  * a call to <code>WorkbenchActivityHelper.filterItem()</code> then <code>null</code> is returned.
  *
  * @see org.eclipse.jface.preference.PreferenceDialog#findNodeMatching(java.lang.String)
  */
 @Override
 protected IPreferenceNode findNodeMatching(String nodeId) {
   IPreferenceNode node = super.findNodeMatching(nodeId);
   if (WorkbenchActivityHelper.filterItem(node)) {
     return null;
   }
   return node;
 }
コード例 #3
0
 private List filterByActivities(List input) {
   ArrayList filteredList = new ArrayList(input.size());
   for (Iterator descriptors = input.iterator(); descriptors.hasNext(); ) {
     SearchPageDescriptor descriptor = (SearchPageDescriptor) descriptors.next();
     if (!WorkbenchActivityHelper.filterItem(descriptor)) filteredList.add(descriptor);
   }
   return filteredList;
 }
コード例 #4
0
 /**
  * Returns all Erlang element filters which are contributed to the given view.
  *
  * @param targetId the target id
  * @return all contributed Erlang element filters for the given view
  */
 public static List<FilterDescriptor> getFilterDescriptors(final String targetId) {
   final Collection<FilterDescriptor> descs = FilterDescriptor.getFilterDescriptors();
   final List<FilterDescriptor> result = Lists.newArrayList();
   for (final FilterDescriptor desc : descs) {
     final String tid = desc.getTargetId();
     if (WorkbenchActivityHelper.filterItem(desc)) {
       continue;
     }
     if (tid == null || tid.equals(targetId)) {
       result.add(desc);
     }
   }
   return result;
 }
コード例 #5
0
 @Override
 public QuickAccessElement[] getElements() {
   if (cachedElements == null) {
     IPerspectiveDescriptor[] perspectives =
         PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();
     cachedElements = new QuickAccessElement[perspectives.length];
     for (int i = 0; i < perspectives.length; i++) {
       if (!WorkbenchActivityHelper.filterItem(perspectives[i])) {
         PerspectiveElement perspectiveElement = new PerspectiveElement(perspectives[i], this);
         idToElement.put(perspectiveElement.getId(), perspectiveElement);
       }
     }
     cachedElements = idToElement.values().toArray(new QuickAccessElement[idToElement.size()]);
   }
   return cachedElements;
 }
コード例 #6
0
ファイル: CWizardRegistry.java プロジェクト: PARAG00991/cdt
 /**
  * Returns extension data for all the C/C++ wizards contributed to the workbench. <wizard name="My
  * C Wizard" icon="icons/cwiz.gif" category="org.eclipse.cdt.ui.newCWizards" id="xx.MyCWizard">
  * <description> My C Wizard </description> </wizard>
  *
  * @return an array of IConfigurationElement
  */
 public static IConfigurationElement[] getAllWizardElements() {
   List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>();
   IExtensionPoint extensionPoint =
       Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
   if (extensionPoint != null) {
     IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
     for (IConfigurationElement element : elements) {
       if (element.getName().equals(TAG_WIZARD)) {
         if (!WorkbenchActivityHelper.filterItem(new WizardConfig(element))) {
           String category = element.getAttribute(ATT_CATEGORY);
           if (category != null
               && (category.equals(CUIPlugin.CCWIZARD_CATEGORY_ID)
                   || category.equals(CUIPlugin.CWIZARD_CATEGORY_ID))) {
             elemList.add(element);
           }
         }
       }
     }
   }
   return elemList.toArray(new IConfigurationElement[elemList.size()]);
 }
コード例 #7
0
  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;
  }