public PluginWorkingSet() {
   super(
       "page1",
       PDEUIMessages.PluginWorkingSet_title,
       PDEPluginImages.DESC_DEFCON_WIZ); // $NON-NLS-1$
   PDEPlugin.getDefault().getLabelProvider().connect(this);
 }
 private void createTabs() {
   for (int i = 0; i < TAB_LABELS.length; i++) {
     CTabItem item = new CTabItem(fTabFolder, SWT.NULL);
     item.setText(TAB_LABELS[i]);
     item.setImage(
         PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_OPERATING_SYSTEM_OBJ));
   }
   fLastTab = 0;
   fTabFolder.setSelection(fLastTab);
 }
 private void createImpTable(Composite container) {
   fElementViewer = new TableViewer(container, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
   GridData gd = new GridData(GridData.FILL_BOTH);
   gd.heightHint = 250;
   fElementViewer.getControl().setLayoutData(gd);
   fElementViewer.getControl().setFont(container.getFont());
   fElementViewer.setContentProvider(
       new DefaultTableProvider() {
         public Object[] getElements(Object inputElement) {
           ITargetDefinition target = getTargetDefinition();
           if (target != null) {
             NameVersionDescriptor[] bundles = target.getImplicitDependencies();
             if (bundles != null) {
               return bundles;
             }
           }
           return new NameVersionDescriptor[0];
         }
       });
   fElementViewer.setLabelProvider(new StyledBundleLabelProvider(false, false));
   fElementViewer.setInput(PDEPlugin.getDefault());
   fElementViewer.setComparator(
       new ViewerComparator() {
         public int compare(Viewer viewer, Object e1, Object e2) {
           NameVersionDescriptor bundle1 = (NameVersionDescriptor) e1;
           NameVersionDescriptor bundle2 = (NameVersionDescriptor) e2;
           return super.compare(viewer, bundle1.getId(), bundle2.getId());
         }
       });
   fElementViewer.addSelectionChangedListener(
       new ISelectionChangedListener() {
         public void selectionChanged(SelectionChangedEvent event) {
           updateImpButtons();
         }
       });
   fElementViewer
       .getTable()
       .addKeyListener(
           new KeyAdapter() {
             public void keyPressed(KeyEvent e) {
               if (e.character == SWT.DEL && e.stateMask == 0) {
                 handleRemove();
               }
             }
           });
 }
 private void handleAdd() {
   ElementListSelectionDialog dialog =
       new ElementListSelectionDialog(
           PDEPlugin.getActiveWorkbenchShell(), PDEPlugin.getDefault().getLabelProvider());
   dialog.setElements(getBundles());
   dialog.setTitle(PDEUIMessages.PluginSelectionDialog_title);
   dialog.setMessage(PDEUIMessages.PluginSelectionDialog_message);
   dialog.setMultipleSelection(true);
   if (dialog.open() == Window.OK) {
     Object[] bundles = dialog.getResult();
     for (int i = 0; i < bundles.length; i++) {
       BundleDescription desc = (BundleDescription) bundles[i];
       addPlugin(desc.getSymbolicName(), "0.0.0"); // $NON-NLS-1$
       // addPlugin(desc.getSymbolicName(), desc.getVersion().toString());
     }
   }
 }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData sectionData = new GridData(GridData.FILL_BOTH);
    sectionData.verticalSpan = 2;
    section.setLayoutData(sectionData);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createOptionalDependenciesButton(container);

    TablePart tablePart = getTablePart();
    fPluginTable = tablePart.getTableViewer();
    fPluginTable.setContentProvider(new ContentProvider());
    fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPluginTable.setComparator(
        new ViewerComparator() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            IProductPlugin p1 = (IProductPlugin) e1;
            IProductPlugin p2 = (IProductPlugin) e2;
            return super.compare(viewer, p1.getId(), p2.getId());
          }
        });
    GridData data = (GridData) tablePart.getControl().getLayoutData();
    data.minimumWidth = 200;
    fPluginTable.setInput(getProduct());

    tablePart.setButtonEnabled(0, isEditable());
    tablePart.setButtonEnabled(1, isEditable());
    tablePart.setButtonEnabled(2, isEditable());

    // remove buttons will be updated on refresh

    tablePart.setButtonEnabled(5, isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);

    section.setText(PDEUIMessages.Product_PluginSection_title);
    section.setDescription(PDEUIMessages.Product_PluginSection_desc);
    getModel().addModelChangedListener(this);
    createSectionToolbar(section, toolkit);
  }
  @Override
  protected void createClient(Section section, FormToolkit toolkit) {
    section.setText(PDEUIMessages.ExportPackageSection_title);
    if (isFragment()) section.setDescription(PDEUIMessages.ExportPackageSection_descFragment);
    else section.setDescription(PDEUIMessages.ExportPackageSection_desc);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    TablePart tablePart = getTablePart();
    fPackageViewer = tablePart.getTableViewer();
    fPackageViewer.setContentProvider(new ExportPackageContentProvider());
    fPackageViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPackageViewer.setComparator(
        new ViewerComparator() {
          @Override
          public int compare(Viewer viewer, Object e1, Object e2) {
            String s1 = e1.toString();
            String s2 = e2.toString();
            if (s1.indexOf(" ") != -1) // $NON-NLS-1$
            s1 = s1.substring(0, s1.indexOf(" ")); // $NON-NLS-1$
            if (s2.indexOf(" ") != -1) // $NON-NLS-1$
            s2 = s2.substring(0, s2.indexOf(" ")); // $NON-NLS-1$
            return super.compare(viewer, s1, s2);
          }
        });
    toolkit.paintBordersFor(container);
    section.setClient(container);
    GridData gd = new GridData(GridData.FILL_BOTH);
    if (((ManifestEditor) getPage().getEditor()).isEquinox()) {
      gd.verticalSpan = 2;
      gd.minimumWidth = 300;
    }
    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    section.setLayoutData(gd);
    makeActions();

    IBundleModel model = getBundleModel();
    fPackageViewer.setInput(model);
    model.addModelChangedListener(this);
    updateButtons();
  }
Beispiel #7
0
  protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = layout.marginHeight = 9;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 300;
    gd.heightHint = 300;
    container.setLayoutData(gd);

    fLoopViewer = new TreeViewer(container);
    fLoopViewer.setContentProvider(new ContentProvider());
    fLoopViewer.setLabelProvider(new LoopLabelProvider());
    Tree tree = fLoopViewer.getTree();
    gd = new GridData(GridData.FILL_BOTH);
    tree.setLayoutData(gd);
    fLoopViewer.setInput(PDEPlugin.getDefault());
    fLoopViewer.expandAll();
    getShell().setText(PDEUIMessages.LoopDialog_title);
    return container;
  }
  class WorkingSetLabelProvider extends LabelProvider {

    PDEPreferencesManager pref = PDEPlugin.getDefault().getPreferenceManager();

    public WorkingSetLabelProvider() {
      PDEPlugin.getDefault().getLabelProvider().connect(this);
    }

    /* (non-Javadoc)
     * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
     */
    public String getText(Object element) {
      if (element instanceof IPluginModelBase) {
        IPluginBase plugin = ((IPluginModelBase) element).getPluginBase();
        String showType = pref.getString(IPreferenceConstants.PROP_SHOW_OBJECTS);
        if (showType.equals(IPreferenceConstants.VALUE_USE_IDS)) return plugin.getId();
        return plugin.getTranslatedName();
      }
      return super.getText(element);
    }

    /* (non-Javadoc)
     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
     */
    public Image getImage(Object element) {
      return PDEPlugin.getDefault().getLabelProvider().getImage(element);
    }

    /* (non-Javadoc)
     * @see org.eclipse.jface.viewers.LabelProvider#dispose()
     */
    public void dispose() {
      super.dispose();
      PDEPlugin.getDefault().getLabelProvider().disconnect(this);
    }
  }
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.LabelProvider#dispose()
  */
 public void dispose() {
   super.dispose();
   PDEPlugin.getDefault().getLabelProvider().disconnect(this);
 }
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
  */
 public Image getImage(Object element) {
   return PDEPlugin.getDefault().getLabelProvider().getImage(element);
 }
 public WorkingSetLabelProvider() {
   PDEPlugin.getDefault().getLabelProvider().connect(this);
 }
Beispiel #12
0
 public LoopDialog(Shell parentShell, DependencyLoop[] loops) {
   super(parentShell);
   fLoops = loops;
   PDELabelProvider provider = PDEPlugin.getDefault().getLabelProvider();
   fLoopImage = provider.get(PDEPluginImages.DESC_LOOP_OBJ);
 }
Beispiel #13
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
  */
 public String getText(Object element) {
   return PDEPlugin.getDefault().getLabelProvider().getText(element);
 }
Beispiel #14
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
  */
 public Image getImage(Object element) {
   if (element instanceof DependencyLoop) return fLoopImage;
   return PDEPlugin.getDefault().getLabelProvider().getImage(element);
 }