コード例 #1
0
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
   */
  protected Control createContents(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);
    link = new Link(comp, SWT.NONE);
    link.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
    link.setFont(comp.getFont());
    link.setText(PDEUIMessages.CompilersPreferencePage_configure_project_specific_settings);
    link.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            HashSet set = new HashSet();
            try {
              IJavaProject[] projects =
                  JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
              IProject project = null;
              for (int i = 0; i < projects.length; i++) {
                project = projects[i].getProject();
                try {
                  if (project.hasNature(PDE.PLUGIN_NATURE)
                      && fBlock.hasProjectSpecificSettings(project)) {
                    set.add(projects[i]);
                  }
                } catch (CoreException ce) {
                  // do nothing ignore the project
                }
              }
            } catch (JavaModelException jme) {
              // ignore
            }
            ProjectSelectionDialog psd = new ProjectSelectionDialog(getShell(), set);
            if (psd.open() == IDialogConstants.OK_ID) {
              HashMap data = new HashMap();
              data.put(NO_LINK, Boolean.TRUE);
              PreferencesUtil.createPropertyDialogOn(
                      getShell(),
                      ((IJavaProject) psd.getFirstResult()).getProject(),
                      "org.eclipse.pde.internal.ui.properties.compilersPropertyPage", //$NON-NLS-1$
                      new String[] {"org.eclipse.pde.internal.ui.properties.compilersPropertyPage"},
                      data)
                  .open(); //$NON-NLS-1$
            }
          }
        });
    fBlock =
        new PDECompilersConfigurationBlock(null, (IWorkbenchPreferenceContainer) getContainer());
    fBlock.createControl(comp);

    // Initialize with data map in case applyData was called before createContents
    applyData(fPageData);

    return comp;
  }
コード例 #2
0
 /** @see org.eclipse.jface.preference.PreferencePage#performDefaults() */
 protected void performDefaults() {
   fBlock.performDefaults();
   super.performDefaults();
 }
コード例 #3
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.preference.PreferencePage#performApply()
  */
 protected void performApply() {
   fBlock.performApply();
   super.performApply();
 }
コード例 #4
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.preference.PreferencePage#performOk()
  */
 public boolean performOk() {
   fBlock.performOK();
   return super.performOk();
 }
コード例 #5
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.preference.PreferencePage#performCancel()
  */
 public boolean performCancel() {
   fBlock.performCancel();
   return super.performCancel();
 }
コード例 #6
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.DialogPage#dispose()
  */
 public void dispose() {
   if (fBlock != null) {
     fBlock.dispose();
   }
   super.dispose();
 }