Пример #1
0
  private void initializeState() {
    fLaunchConfigCombo.setEnabled(false);
    if (fLaunchConfigCombo.getItemCount() > 0)
      fLaunchConfigCombo.setText(fLaunchConfigCombo.getItem(0));

    if (fModel != null && fModel.getPluginBase().getId() != null) {
      IPluginExtension[] extensions = fModel.getPluginBase().getExtensions();
      for (int i = 0; i < extensions.length; i++) {
        String point = extensions[i].getPoint();
        if ("org.eclipse.core.runtime.products".equals(point)) { // $NON-NLS-1$
          String id = extensions[i].getId();
          if (id != null) {
            String full = fModel.getPluginBase().getId() + "." + id; // $NON-NLS-1$
            if (fProductCombo.indexOf(full) != -1) {
              fProductCombo.setText(full);
              fProductButton.setSelection(true);
              return;
            }
          }
        }
      }
    }

    fBasicButton.setSelection(true);

    fProductCombo.setEnabled(false);
    if (fProductCombo.getItemCount() > 0) fProductCombo.setText(fProductCombo.getItem(0));
  }
 private void createOptionalDependenciesButton(Composite container) {
   if (isEditable()) {
     fIncludeOptionalButton = new Button(container, SWT.CHECK);
     fIncludeOptionalButton.setText(PDEUIMessages.PluginSection_includeOptional);
     // initialize value
     IEditorInput input = getPage().getEditorInput();
     if (input instanceof IFileEditorInput) {
       IFile file = ((IFileEditorInput) input).getFile();
       try {
         fIncludeOptionalButton.setSelection(
             "true".equals(file.getPersistentProperty(OPTIONAL_PROPERTY))); // $NON-NLS-1$
       } catch (CoreException e) {
       }
     }
     // create listener to save value when the checkbox is changed
     fIncludeOptionalButton.addSelectionListener(
         new SelectionAdapter() {
           public void widgetSelected(SelectionEvent e) {
             IEditorInput input = getPage().getEditorInput();
             if (input instanceof IFileEditorInput) {
               IFile file = ((IFileEditorInput) input).getFile();
               try {
                 file.setPersistentProperty(
                     OPTIONAL_PROPERTY,
                     fIncludeOptionalButton.getSelection() ? "true" : null); // $NON-NLS-1$
               } catch (CoreException e1) {
               }
             }
           }
         });
   }
 }
 private void createUICategoryButton(Composite parent) {
   fCategoryButton = new Button(parent, SWT.PUSH);
   GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
   data.widthHint = 50;
   fCategoryButton.setLayoutData(data);
   fCategoryButton.setText(CSWizardMessages.RegisterCSWizardPage_new);
   fCategoryButton.setToolTipText(CSWizardMessages.RegisterCSWizardPage_newTooltip);
   SWTUtil.setButtonDimensionHint(fCategoryButton);
 }
Пример #4
0
  public ILaunchConfiguration getSelectedLaunchConfiguration() {
    if (!fLaunchConfigButton.getSelection()) return null;

    String configName = fLaunchConfigCombo.getText();
    try {
      ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
      ILaunchConfigurationType type =
          manager.getLaunchConfigurationType(EclipseLaunchShortcut.CONFIGURATION_TYPE);
      ILaunchConfigurationType type2 =
          manager.getLaunchConfigurationType(IPDELauncherConstants.OSGI_CONFIGURATION_TYPE);
      ILaunchConfiguration[] configs = manager.getLaunchConfigurations(type);
      ILaunchConfiguration[] configs2 = manager.getLaunchConfigurations(type2);
      ILaunchConfiguration[] configurations =
          new ILaunchConfiguration[configs.length + configs2.length];
      System.arraycopy(configs, 0, configurations, 0, configs.length);
      System.arraycopy(configs2, 0, configurations, configs.length, configs2.length);
      for (int i = 0; i < configurations.length; i++) {
        if (configurations[i].getName().equals(configName)
            && !DebugUITools.isPrivate(configurations[i])) return configurations[i];
      }
    } catch (CoreException e) {
      PDEPlugin.logException(e);
    }
    return null;
  }
 private void createUIListenersCategoryButton() {
   fCategoryButton.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(SelectionEvent e) {
           handleWidgetSelectedCategoryButton();
         }
       });
 }
 /* (non-Javadoc)
  * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#buttonSelected(int)
  */
 protected void buttonSelected(int index) {
   switch (index) {
     case 0:
       handleAdd();
       break;
     case 1:
       handleAddWorkingSet();
       break;
     case 2:
       handleAddRequired(getProduct().getPlugins(), fIncludeOptionalButton.getSelection());
       break;
     case 3:
       handleDelete();
       break;
     case 4:
       handleRemoveAll();
       break;
     case 5:
       handleProperties();
       break;
   }
 }
Пример #7
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#createAdvancedControls(org.eclipse.swt.widgets.Composite)
   */
  protected void createAdvancedControls(Composite parent) {
    fGroup = new Group(parent, SWT.NONE);
    fGroup.setText(PDEUIMessages.ProductFileWizadPage_groupTitle);
    fGroup.setLayout(new GridLayout(2, false));
    fGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fBasicButton = new Button(fGroup, SWT.RADIO);
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    fBasicButton.setLayoutData(gd);
    fBasicButton.setText(PDEUIMessages.ProductFileWizadPage_basic);

    fProductButton = new Button(fGroup, SWT.RADIO);
    fProductButton.setText(PDEUIMessages.ProductFileWizadPage_existingProduct);
    fProductButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fProductCombo.setEnabled(fProductButton.getSelection());
          }
        });

    fProductCombo = new Combo(fGroup, SWT.SINGLE | SWT.READ_ONLY);
    fProductCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fProductCombo.setItems(TargetPlatform.getProducts());

    fLaunchConfigButton = new Button(fGroup, SWT.RADIO);
    fLaunchConfigButton.setText(PDEUIMessages.ProductFileWizadPage_existingLaunchConfig);
    fLaunchConfigButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fLaunchConfigCombo.setEnabled(fLaunchConfigButton.getSelection());
          }
        });

    fLaunchConfigCombo = new Combo(fGroup, SWT.SINGLE | SWT.READ_ONLY);
    fLaunchConfigCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fLaunchConfigCombo.setItems(getLaunchConfigurations());

    initializeState();
  }
Пример #8
0
 public int getInitializationOption() {
   if (fBasicButton.getSelection()) return USE_DEFAULT;
   if (fProductButton.getSelection()) return USE_PRODUCT;
   return USE_LAUNCH_CONFIG;
 }
Пример #9
0
 public String getSelectedProduct() {
   return fProductButton.getSelection() ? fProductCombo.getText() : null;
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    setControl(composite);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(PDEUIMessages.PluginWorkingSet_setName);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fWorkingSetName = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fWorkingSetName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fWorkingSetName.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            validatePage();
          }
        });
    fWorkingSetName.setFocus();

    label = new Label(composite, SWT.WRAP);
    label.setText(PDEUIMessages.PluginWorkingSet_setContent);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fTree = new CheckboxFilteredTree(composite, SWT.BORDER, new PatternFilter());
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 250;
    fTree.getViewer().getControl().setLayoutData(gd);
    final IStructuredContentProvider fTableContentProvider = new ContentProvider();
    fTree.getCheckboxTreeViewer().setContentProvider(fTableContentProvider);
    fTree.getCheckboxTreeViewer().setLabelProvider(new WorkingSetLabelProvider());
    fTree.getCheckboxTreeViewer().setUseHashlookup(true);
    fTree.getCheckboxTreeViewer().setInput(PDECore.getDefault());

    fTree
        .getCheckboxTreeViewer()
        .addCheckStateListener(
            new ICheckStateListener() {
              public void checkStateChanged(CheckStateChangedEvent event) {
                validatePage();
              }
            });

    // Add select / deselect all buttons for bug 46669
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    buttonComposite.setLayout(new GridLayout(2, true));
    buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
    selectAllButton.setText(PDEUIMessages.PluginWorkingSet_selectAll_label);
    selectAllButton.setToolTipText(PDEUIMessages.PluginWorkingSet_selectAll_toolTip);
    selectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent selectionEvent) {
            fTree
                .getCheckboxTreeViewer()
                .setCheckedElements(
                    fTableContentProvider.getElements(fTree.getCheckboxTreeViewer().getInput()));
            validatePage();
          }
        });
    selectAllButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(selectAllButton);

    Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
    deselectAllButton.setText(PDEUIMessages.PluginWorkingSet_deselectAll_label);
    deselectAllButton.setToolTipText(PDEUIMessages.PluginWorkingSet_deselectAll_toolTip);
    deselectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent selectionEvent) {
            fTree.getCheckboxTreeViewer().setCheckedElements(new Object[0]);
            validatePage();
          }
        });
    deselectAllButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(deselectAllButton);
    setPageComplete(false);
    setMessage(PDEUIMessages.PluginWorkingSet_message);

    initialize();
    Dialog.applyDialogFont(composite);

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(composite, IHelpContextIds.PLUGIN_WORKING_SET);
  }
 public boolean includeOptionalDependencies() {
   return fIncludeOptionalButton.getSelection();
 }