org.eclipse.pde.api.tools.ui_1.0.301.v20110803_r371

   {
      public void widgetSelected(SelectionEvent e)
      {
        String loc = getArchive(null);
        if (loc != null) {
          addLocation(loc);
        }
      }
    });
    editbutton = SWTFactory.createPushButton(bcomp, PreferenceMessages.ApiUseScanPreferencePage_1, null);
    editbutton.setEnabled(false);
    editbutton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        edit();
      }
    });
    remove = SWTFactory.createPushButton(bcomp, PreferenceMessages.ApiUseScanPreferencePage_6, null);
    remove.setEnabled(false);
    remove.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        removeLocation();
      }
    });
    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        IStructuredSelection selection = (IStructuredSelection)fTableViewer.getSelection();
        remove.setEnabled(!selection.isEmpty());
        editbutton.setEnabled(selection.size() == 1);
      }
    });
    fTableViewer.addDoubleClickListener(new IDoubleClickListener()
    {
      public void doubleClick(DoubleClickEvent event)
      {
        edit();
      }
    });
    HashMap linkdata = new HashMap();
    linkdata.put("PropertyAndPreferencePage.initialTab", new Integer(4));
    PreferenceLinkArea apiErrorLinkArea = new PreferenceLinkArea(comp, 0, 
      "org.eclipse.pde.api.tools.ui.apitools.errorwarnings.prefpage", PreferenceMessages.ApiUseScanPreferencePage_9, 
      (IWorkbenchPreferenceContainer)getContainer(), linkdata);
    GridData data = new GridData(768);
    widthHint = 250;
    horizontalSpan = 2;
    apiErrorLinkArea.getControl().setLayoutData(data);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IApiToolsHelpContextIds.APIUSESCANS_PREF_PAGE);
    performInit();
    validateScans();
    Dialog.applyDialogFont(comp);
    return comp;
  }
  
  void select(boolean checked)
  {
    fTableViewer.setAllChecked(checked);
    fTableViewer.refresh();
  }
  
  String getDirectory(String prevLocation)
  {
    DirectoryDialog dialog = new DirectoryDialog(getShell());
    dialog.setMessage(PreferenceMessages.ApiUseScanPreferencePage_7);
    if (prevLocation != null) {
      dialog.setFilterPath(prevLocation);
    }
    return dialog.open();
  }
  
  String getArchive(File file)
  {
    FileDialog dialog = new FileDialog(getShell(), 4096);
    dialog.setFilterNames(new String[] { PreferenceMessages.archives__zip });
    dialog.setFilterExtensions(new String[] { "*.zip;*.jar" });
    if (file != null)
    {
      dialog.setFilterPath(file.getParent());
      dialog.setFileName(file.getName());
    }
    return dialog.open();
  }
  
  void addLocation(String location)
  {
    fLocationList.add(location);
    fTableViewer.refresh();
    fTableViewer.setChecked(location, true);
    fTableViewer.setSelection(new StructuredSelection(location));
    
    validateScans();
  }
  
  void edit()
  {
    IStructuredSelection selection = (IStructuredSelection)fTableViewer.getSelection();
    String location = selection.getFirstElement().toString();
    File file = new File(location);
    String newloc = null;
    if (file.isDirectory()) {
      newloc = getDirectory(location);
    } else {
      newloc = getArchive(file);
    }
    if (newloc != null)
    {
      fLocationList.remove(location);
      addLocation(newloc);
    }
  }
  
  void removeLocation()
  {
    IStructuredSelection selection = (IStructuredSelection)fTableViewer.getSelection();
    fLocationList.removeAll(selection.toList());
    fTableViewer.refresh();
    validateScans();
  }
  
  private void validateScans()
  {
    if (fLocationList.size() > 0)
    {
      String loc = null;
      for (Iterator iterator = fLocationList.iterator(); iterator.hasNext();)
      {
        loc = (String)iterator.next();
        if (!UseScanManager.isValidScanLocation(loc))
        {
          setErrorMessage(NLS.bind(PreferenceMessages.ApiUseScanPreferencePage_8, loc));
          setValid(false);
          return;
        }
      }
    }
    setValid(true);
    setErrorMessage(null);
  }
  
  public boolean performOk()
  {
    applyChanges();
    return true;
  }
  
  protected void performApply()
  {
    applyChanges();
  }
  
  protected void performDefaults()
  {
    fLocationList.clear();
    fTableViewer.refresh();
    super.performDefaults();
  }
  
  private void performInit()
  {
    if (getContainer() == null) {
      fManager = new WorkingCopyManager();
    } else {
      fManager = ((IWorkbenchPreferenceContainer)getContainer()).getWorkingCopyManager();
    }
    fLocationList.clear();
    
    String location = getStoredValue("API_USE_SCAN_LOCATION", null);
    
    ArrayList checkedLocations = new ArrayList();
    if ((location != null) && (location.length() > 0))
    {
      String[] locations = location.split("\\|");
      for (int i = 0; i < locations.length; i++)
      {
        String[] values = locations[i].split("\\*");
        fLocationList.add(values[0]);
        if (Boolean.valueOf(values[1]).booleanValue()) {
          checkedLocations.add(values[0]);
        }
      }
      fLocationList.remove("");
    }
    fTableViewer.setInput(fLocationList);
    fTableViewer.setCheckedElements(checkedLocations.toArray(new String[checkedLocations.size()]));
    fTableViewer.refresh();
    
    setErrorMessage(null);
  }
  
  private void applyChanges()
  {
    StringBuffer locations = new StringBuffer();
    for (Iterator iterator = fLocationList.iterator(); iterator.hasNext();)
    {
      Object location = iterator.next();
      locations.append(location);
      locations.append("*");
      locations.append(fTableViewer.getChecked(location));
      locations.append("|");
    }
    if (hasLocationsChanges(locations.toString()))
    {
      IProject[] projects = Util.getApiProjects();
      if ((projects != null) && 
        (MessageDialog.openQuestion(getShell(), PreferenceMessages.ApiUseScanPreferencePage_11, PreferenceMessages.ApiUseScanPreferencePage_12))) {
        Util.getBuildJob(projects).schedule();
      }
    }
    setStoredValue("API_USE_SCAN_LOCATION", locations.toString());
    try
    {
      fManager.applyChanges();
    }
    catch (BackingStoreException e)
    {
      ApiUIPlugin.log(e);
    }
  }
  
  private boolean hasLocationsChanges(String newLocations)
  {
    String oldLocations = getStoredValue("API_USE_SCAN_LOCATION", null);
    if ((oldLocations != null) && (oldLocations.equalsIgnoreCase(newLocations))) {
      return false;
    }
    ArrayList oldCheckedElements = new ArrayList();
    if ((oldLocations != null) && (oldLocations.length() > 0))
    {
      String[] locations = oldLocations.split("\\|");
      for (int i = 0; i < locations.length; i++)
      {
        String[] values = locations[i].split("\\*");
        if (Boolean.valueOf(values[1]).booleanValue()) {
          oldCheckedElements.add(values[0]);
        }
      }
    }
    Object[] newCheckedLocations = fTableViewer.getCheckedElements();
    if (newCheckedLocations.length != oldCheckedElements.size()) {
      return true;
    }
    for (int i = 0; i < newCheckedLocations.length; i++) {
      if (!oldCheckedElements.contains(newCheckedLocations[i])) {
        return true;
      }
    }
    return false;
  }
  
  public void setStoredValue(String key, String value)
  {
    IEclipsePreferences node = getNode();
    if (value != null) {
      node.put(key, value);
    } else {
      node.remove(key);
    }
  }
  
  public String getStoredValue(String key, String defaultValue)
  {
    IEclipsePreferences node = getNode();
    if (node != null) {
      return node.get(key, defaultValue);
    }
    return defaultValue;
  }
  
  private IEclipsePreferences getNode()
  {
    IEclipsePreferences node = InstanceScope.INSTANCE.getNode("org.eclipse.pde.api.tools");
    if (fManager != null) {
      return fManager.getWorkingCopy(node);
    }
    return node;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiUseScanPreferencePage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import org.eclipse.osgi.util.NLS;

public class PreferenceMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.pde.api.tools.ui.internal.preferences.preferencemessages";
  public static String ApiErrorsWarningsConfigurationBlock_0;
  public static String ApiErrorsWarningsConfigurationBlock_1;
  public static String ApiErrorsWarningsConfigurationBlock_2;
  public static String ApiErrorsWarningsConfigurationBlock_automatically_remove_problem_filters;
  public static String ApiErrorsWarningsPreferencePage_0;
  public static String ApiErrorsWarningsPreferencePage_1;
  public static String ApiProblemSeveritiesConfigurationBlock_3;
  public static String ApiProblemSeveritiesNoImplement;
  public static String ApiProblemSeveritiesNoExtend;
  public static String ApiProblemSeveritiesNoReference;
  public static String ApiProblemSeveritiesNoInstanciate;
  public static String ApiProblemSeveritiesConfigurationBlock_8;
  public static String ApiProblemSeveritiesConfigurationBlock_9;
  public static String ApiProblemSeveritiesConfigurationBlock_10;
  public static String ApiProblemSeveritiesConfigurationBlock_11;
  public static String ApiProfilesPreferencePage_0;
  public static String ApiProfilesPreferencePage_1;
  public static String ApiProfilesPreferencePage_2;
  public static String ApiProfilesPreferencePage_3;
  public static String ApiProfilesPreferencePage_4;
  public static String ApiProfilesPreferencePage_6;
  public static String ApiProfilesPreferencePage_7;
  public static String ApiToolingNotificationsBlock_0;
  public static String ApiToolingNotificationsBlock_1;
  public static String ApiToolingNotificationsBlock_2;
  public static String ApiToolingNotificationsBlock_3;
  public static String ApiToolingNotificationsBlock_4;
  public static String CompatibilityAPIComponentElement;
  public static String CompatibilityAnnotationElement;
  public static String CompatibilityInterfaceElement;
  public static String CompatibilityEnumElement;
  public static String CompatibilityClassElement;
  public static String CompatibilityFieldElement;
  public static String CompatibilityMethodElement;
  public static String CompatibilityConstructorElement;
  public static String CompatibilityTypeParameterElement;
  public static String CompatibilityReportApiBreakageWhenMajorVersionIncremented;
  public static String ReportApiComponentResolutionFailure;
  public static String ReportApiComponentResolutionFailureDescription;
  public static String ApiErrorsWarningsConfigurationBlock_error;
  public static String ApiErrorsWarningsConfigurationBlock_warning;
  public static String ApiErrorsWarningsConfigurationBlock_ignore;
  public static String ApiErrorsWarningsConfigurationBlock_error_button;
  public static String ApiErrorsWarningsConfigurationBlock_extend_non_api_class;
  public static String ApiErrorsWarningsConfigurationBlock_field_decl_non_api;
  public static String ApiErrorsWarningsConfigurationBlock_general;
  public static String ApiErrorsWarningsConfigurationBlock_warning_button;
  public static String ApiErrorsWarningsConfigurationBlock_ignore_button;
  public static String ApiErrorsWarningsConfigurationBlock_implement_non_api;
  public static String ApiErrorsWarningsConfigurationBlock_invalid_tag_use;
  public static String ApiErrorsWarningsConfigurationBlock_invalid_reference_to_system_libraries;
  public static String ApiErrorsWarningsConfigurationBlock_leaks;
  public static String ApiErrorsWarningsConfigurationBlock_no_ees_installed;
  public static String ApiErrorsWarningsConfigurationBlock_override_tagged_method;
  public static String ApiErrorsWarningsConfigurationBlock_parameter_non_api;
  public static String ApiErrorsWarningsConfigurationBlock_restrictions;
  public static String ApiErrorsWarningsConfigurationBlock_return_type_non_api;
  public static String ProjectSelectionDialog_title;
  public static String ProjectSelectionDialog_message;
  public static String ProjectSelectionDialog_checkbox_text;
  public static String ApiProfilesConfigurationBlock_options_group_title;
  public static String ApiProfilesConfigurationBlock_missing_default_api_profile_message;
  public static String API_COMPONENT_REMOVED_API_TYPE;
  public static String API_COMPONENT_REMOVED_TYPE;
  public static String API_COMPONENT_REMOVED_REEXPORTED_API_TYPE;
  public static String API_COMPONENT_REMOVED_REEXPORTED_TYPE;
  public static String ANNOTATION_ADDED_METHOD_NO_DEFAULT_VALUE;
  public static String ANNOTATION_REMOVED_FIELD;
  public static String ANNOTATION_REMOVED_METHOD;
  public static String ANNOTATION_REMOVED_TYPE_MEMBER;
  public static String ANNOTATION_CHANGED_TYPE_CONVERSION;
  public static String INTERFACE_ADDED_FIELD;
  public static String INTERFACE_ADDED_METHOD;
  public static String INTERFACE_ADDED_RESTRICTIONS;
  public static String INTERFACE_ADDED_SUPER_INTERFACE_WITH_METHODS;
  public static String INTERFACE_ADDED_TYPE_PARAMETER;
  public static String INTERFACE_REMOVED_TYPE_PARAMETER;
  public static String INTERFACE_REMOVED_FIELD;
  public static String INTERFACE_REMOVED_METHOD;
  public static String INTERFACE_REMOVED_TYPE_MEMBER;
  public static String INTERFACE_CHANGED_TYPE_CONVERSION;
  public static String INTERFACE_CHANGED_CONTRACTED_SUPERINTERFACES_SET;
  public static String ENUM_CHANGED_CONTRACTED_SUPERINTERFACES_SET;
  public static String ENUM_CHANGED_TYPE_CONVERSION;
  public static String ENUM_REMOVED_FIELD;
  public static String ENUM_REMOVED_ENUM_CONSTANT;
  public static String ENUM_REMOVED_METHOD;
  public static String ENUM_REMOVED_TYPE_MEMBER;
  public static String CLASS_ADDED_METHOD;
  public static String CLASS_ADDED_TYPE_PARAMETER;
  public static String CLASS_CHANGED_CONTRACTED_SUPERINTERFACES_SET;
  public static String CLASS_CHANGED_NON_ABSTRACT_TO_ABSTRACT;
  public static String CLASS_CHANGED_NON_FINAL_TO_FINAL;
  public static String CLASS_CHANGED_TYPE_CONVERSION;
  public static String CLASS_CHANGED_DECREASE_ACCESS;
  public static String CLASS_ADDED_RESTRICTIONS;
  public static String CLASS_REMOVED_FIELD;
  public static String CLASS_REMOVED_METHOD;
  public static String CLASS_REMOVED_CONSTRUCTOR;
  public static String CLASS_REMOVED_SUPERCLASS;
  public static String CLASS_REMOVED_TYPE_MEMBER;
  public static String CLASS_REMOVED_TYPE_PARAMETER;
  public static String FIELD_ADDED_VALUE;
  public static String FIELD_CHANGED_TYPE;
  public static String FIELD_CHANGED_VALUE;
  public static String FIELD_CHANGED_DECREASE_ACCESS;
  public static String FIELD_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT;
  public static String FIELD_CHANGED_NON_FINAL_TO_FINAL;
  public static String FIELD_CHANGED_STATIC_TO_NON_STATIC;
  public static String FIELD_CHANGED_NON_STATIC_TO_STATIC;
  public static String FIELD_REMOVED_VALUE;
  public static String FIELD_REMOVED_TYPE_ARGUMENT;
  public static String METHOD_ADDED_TYPE_PARAMETER;
  public static String METHOD_CHANGED_VARARGS_TO_ARRAY;
  public static String METHOD_CHANGED_DECREASE_ACCESS;
  public static String METHOD_CHANGED_NON_ABSTRACT_TO_ABSTRACT;
  public static String METHOD_CHANGED_NON_STATIC_TO_STATIC;
  public static String METHOD_ADDED_RESTRICTIONS;
  public static String METHOD_CHANGED_STATIC_TO_NON_STATIC;
  public static String METHOD_CHANGED_NON_FINAL_TO_FINAL;
  public static String METHOD_REMOVED_ANNOTATION_DEFAULT_VALUE;
  public static String METHOD_REMOVED_TYPE_PARAMETER;
  public static String CONSTRUCTOR_ADDED_TYPE_PARAMETER;
  public static String CONSTRUCTOR_CHANGED_VARARGS_TO_ARRAY;
  public static String CONSTRUCTOR_CHANGED_DECREASE_ACCESS;
  public static String CONSTRUCTOR_REMOVED_TYPE_PARAMETER;
  public static String TYPE_PARAMETER_ADDED_CLASS_BOUND;
  public static String TYPE_PARAMETER_ADDED_INTERFACE_BOUND;
  public static String TYPE_PARAMETER_CHANGED_CLASS_BOUND;
  public static String TYPE_PARAMETER_CHANGED_INTERFACE_BOUND;
  public static String TYPE_PARAMETER_REMOVED_CLASS_BOUND;
  public static String TYPE_PARAMETER_REMOVED_INTERFACE_BOUND;
  public static String VersionManagementReportMissingSinceTag;
  public static String VersionManagementReportMalformedSinceTags;
  public static String VersionManagementReportInvalidSinceTagVersion;
  public static String VersionManagementReportInvalidApiComponentVersion;
  public static String ApiErrorsWarningsConfigurationBlock_setAllto;
  public static String ApiErrorsWarningsConfigurationBlock_unused_problem_filters;
  public static String VersionManagementReportInvalidApiComponentVersionIncludeMinorWithoutApiChange;
  public static String VersionManagementReportInvalidApiComponentVersionIncludeMajorWithoutBreakingChange;
  public static String ApiProblemSeveritiesConfigurationBlock_checkable_ees;
  public static String ApiProblemSeveritiesConfigurationBlock_checkable_ees_tooltip;
  public static String ApiProblemSeveritiesConfigurationBlock_checkable_ees_link_label;
  public static String ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_title;
  public static String ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_description;
  public static String ApiUseScanConfigurationBlock_0;
  public static String ApiUseScanConfigurationBlock_unresolvedTypeProblem;
  public static String ApiUseScanConfigurationBlock_unresolvedMethodProblem;
  public static String ApiUseScanConfigurationBlock_unresolvedFieldProblem;
  public static String ApiUseScanPreferencePage_0;
  public static String ApiUseScanPreferencePage_1;
  public static String ApiUseScanPreferencePage_10;
  public static String ApiUseScanPreferencePage_11;
  public static String ApiUseScanPreferencePage_12;
  public static String ApiUseScanPreferencePage_2;
  public static String ApiUseScanPreferencePage_3;
  public static String ApiUseScanPreferencePage_4;
  public static String ApiUseScanPreferencePage_5;
  public static String ApiUseScanPreferencePage_6;
  public static String ApiUseScanPreferencePage_7;
  public static String ApiUseScanPreferencePage_8;
  public static String ApiUseScanPreferencePage_9;
  public static String archives__zip;
  
  static
  {
    NLS.initializeMessages("org.eclipse.pde.api.tools.ui.internal.preferences.preferencemessages", PreferenceMessages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.PreferenceMessages
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import java.util.Set;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

class ProjectSelectionDialog$1
  extends ViewerFilter
{
  final ProjectSelectionDialog this$0;
  
  ProjectSelectionDialog$1(ProjectSelectionDialog paramProjectSelectionDialog)
  {
    this$0 = paramProjectSelectionDialog;
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    return this$0.fProjectsWithSpecifics.contains(element);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ProjectSelectionDialog.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class ProjectSelectionDialog$2
  implements ISelectionChangedListener
{
  final ProjectSelectionDialog this$0;
  
  ProjectSelectionDialog$2(ProjectSelectionDialog paramProjectSelectionDialog)
  {
    this$0 = paramProjectSelectionDialog;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    this$0.doSelectionChanged(((IStructuredSelection)event.getSelection()).toArray());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ProjectSelectionDialog.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;

class ProjectSelectionDialog$3
  implements IDoubleClickListener
{
  final ProjectSelectionDialog this$0;
  
  ProjectSelectionDialog$3(ProjectSelectionDialog paramProjectSelectionDialog)
  {
    this$0 = paramProjectSelectionDialog;
  }
  
  public void doubleClick(DoubleClickEvent event)
  {
    ProjectSelectionDialog.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ProjectSelectionDialog.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Button;

class ProjectSelectionDialog$4
  implements SelectionListener
{
  final ProjectSelectionDialog this$0;
  
  ProjectSelectionDialog$4(ProjectSelectionDialog paramProjectSelectionDialog)
  {
    this$0 = paramProjectSelectionDialog;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.updateFilter(((Button)widget).getSelection());
  }
  
  public void widgetDefaultSelected(SelectionEvent e)
  {
    this$0.updateFilter(((Button)widget).getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ProjectSelectionDialog.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import java.util.HashSet;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.StandardJavaElementContentProvider;

class ProjectSelectionDialog$ApiJavaElementContentProvider
  extends StandardJavaElementContentProvider
{
  public Object[] getChildren(Object element)
  {
    if ((element instanceof IJavaModel))
    {
      IJavaModel model = (IJavaModel)element;
      HashSet set = new HashSet();
      try
      {
        IJavaProject[] projects = model.getJavaProjects();
        for (int i = 0; i < projects.length; i++) {
          if (projects[i].getProject().hasNature("org.eclipse.pde.api.tools.apiAnalysisNature")) {
            set.add(projects[i]);
          }
        }
      }
      catch (JavaModelException localJavaModelException) {}catch (CoreException localCoreException) {}
      return set.toArray();
    }
    return super.getChildren(element);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ProjectSelectionDialog.ApiJavaElementContentProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.preferences;

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaElementComparator;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin;
import org.eclipse.pde.api.tools.ui.internal.IApiToolsHelpContextIds;
import org.eclipse.pde.api.tools.ui.internal.SWTFactory;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionStatusDialog;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public class ProjectSelectionDialog
  extends SelectionStatusDialog
{
  private TableViewer fTableViewer;
  Set fProjectsWithSpecifics;
  private static final int SIZING_SELECTION_WIDGET_HEIGHT = 250;
  private static final int SIZING_SELECTION_WIDGET_WIDTH = 300;
  private static final String DIALOG_SETTINGS_SHOW_ALL = "ProjectSelectionDialog.show_all";
  private ViewerFilter fFilter;
  
  static class ApiJavaElementContentProvider
    extends StandardJavaElementContentProvider
  {
    public Object[] getChildren(Object element)
    {
      if ((element instanceof IJavaModel))
      {
        IJavaModel model = (IJavaModel)element;
        HashSet set = new HashSet();
        try
        {
          IJavaProject[] projects = model.getJavaProjects();
          for (int i = 0; i < projects.length; i++) {
            if (projects[i].getProject().hasNature("org.eclipse.pde.api.tools.apiAnalysisNature")) {
              set.add(projects[i]);
            }
          }
        }
        catch (JavaModelException localJavaModelException) {}catch (CoreException localCoreException) {}
        return set.toArray();
      }
      return super.getChildren(element);
    }
  }
  
  public ProjectSelectionDialog(Shell parentShell, Set projectsWithSpecifics)
  {
    super(parentShell);
    setTitle(PreferenceMessages.ProjectSelectionDialog_title);
    setMessage(PreferenceMessages.ProjectSelectionDialog_message);
    fProjectsWithSpecifics = projectsWithSpecifics;
    
    fFilter = new ViewerFilter()
    {
      public boolean select(Viewer viewer, Object parentElement, Object element)
      {
        return fProjectsWithSpecifics.contains(element);
      }
    };
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    
    Font font = parent.getFont();
    composite.setFont(font);
    
    createMessageArea(composite);
    
    fTableViewer = new TableViewer(composite, 2816);
    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        doSelectionChanged(((IStructuredSelection)event.getSelection()).toArray());
      }
    });
    fTableViewer.addDoubleClickListener(new IDoubleClickListener()
    {
      public void doubleClick(DoubleClickEvent event)
      {
        okPressed();
      }
    });
    GridData data = new GridData(4, 4, true, true);
    heightHint = 250;
    widthHint = 300;
    fTableViewer.getTable().setLayoutData(data);
    
    fTableViewer.setLabelProvider(new JavaElementLabelProvider());
    fTableViewer.setContentProvider(new ApiJavaElementContentProvider());
    fTableViewer.setComparator(new JavaElementComparator());
    fTableViewer.getControl().setFont(font);
    
    Button checkbox = SWTFactory.createCheckButton(composite, PreferenceMessages.ProjectSelectionDialog_checkbox_text, null, false, 1);
    checkbox.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent e)
      {
        updateFilter(((Button)widget).getSelection());
      }
      
      public void widgetDefaultSelected(SelectionEvent e)
      {
        updateFilter(((Button)widget).getSelection());
      }
    });
    IDialogSettings dialogSettings = ApiUIPlugin.getDefault().getDialogSettings();
    boolean doFilter = (!dialogSettings.getBoolean("ProjectSelectionDialog.show_all")) && (!fProjectsWithSpecifics.isEmpty());
    checkbox.setSelection(doFilter);
    updateFilter(doFilter);
    
    IJavaModel input = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
    fTableViewer.setInput(input);
    
    doSelectionChanged(new Object[0]);
    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IApiToolsHelpContextIds.APITOOLS_PROJECT_SPECIFIC_SETTINGS_SELECTION_DIALOG);
    return composite;
  }
  
  void doSelectionChanged(Object[] objects)
  {
    if (objects.length != 1)
    {
      updateStatus(new Status(4, ApiUIPlugin.getPluginIdentifier(), ""));
      setSelectionResult(null);
    }
    else
    {
      updateStatus(new Status(0, ApiUIPlugin.getPluginIdentifier(), ""));
      setSelectionResult(objects);
    }
  }
  
  protected void updateFilter(boolean selected)
  {
    if (selected) {
      fTableViewer.addFilter(fFilter);
    } else {
      fTableViewer.removeFilter(fFilter);
    }
    ApiUIPlugin.getDefault().getDialogSettings().put("ProjectSelectionDialog.show_all", !selected);
  }
  
  protected void computeResult() {}
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ProjectSelectionDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Link;

class ApiErrorsWarningsPropertyPage$1
  extends SelectionAdapter
{
  final ApiErrorsWarningsPropertyPage this$0;
  
  ApiErrorsWarningsPropertyPage$1(ApiErrorsWarningsPropertyPage paramApiErrorsWarningsPropertyPage)
  {
    this$0 = paramApiErrorsWarningsPropertyPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    boolean psp = this$0.pspecific.getSelection();
    this$0.block.useProjectSpecificSettings(psp);
    if (this$0.link != null) {
      this$0.link.setEnabled(!psp);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.properties.ApiErrorsWarningsPropertyPage.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import java.util.HashMap;
import org.eclipse.pde.api.tools.ui.internal.SWTFactory;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ApiErrorsWarningsPropertyPage$2
  extends SelectionAdapter
{
  final ApiErrorsWarningsPropertyPage this$0;
  
  ApiErrorsWarningsPropertyPage$2(ApiErrorsWarningsPropertyPage paramApiErrorsWarningsPropertyPage)
  {
    this$0 = paramApiErrorsWarningsPropertyPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    HashMap data = new HashMap();
    data.put("PropertyAndPreferencePage.nolink", Boolean.TRUE);
    SWTFactory.showPreferencePage(this$0.getShell(), "org.eclipse.pde.api.tools.ui.apitools.errorwarnings.prefpage", data);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.properties.ApiErrorsWarningsPropertyPage.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import java.util.HashMap;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.pde.api.tools.ui.internal.IApiToolsHelpContextIds;
import org.eclipse.pde.api.tools.ui.internal.SWTFactory;
import org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;

public class ApiErrorsWarningsPropertyPage
  extends PropertyPage
{
  private HashMap fPageData = null;
  ApiErrorsWarningsConfigurationBlock block = null;
  Button pspecific = null;
  Link link = null;
  
  protected Control createContents(Composite parent)
  {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, 1808, 0, 0);
    Composite tcomp = SWTFactory.createComposite(comp, 2, 1, 768, 0, 0);
    pspecific = SWTFactory.createCheckButton(tcomp, PropertiesMessages.ApiErrorWarningsPropertyPage_0, null, false, 1);
    GridData gd = (GridData)pspecific.getLayoutData();
    horizontalAlignment = 1;
    verticalAlignment = 2;
    pspecific.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        boolean psp = pspecific.getSelection();
        block.useProjectSpecificSettings(psp);
        if (link != null) {
          link.setEnabled(!psp);
        }
      }
    });
    if (offerLink())
    {
      link = new Link(tcomp, 0);
      link.setLayoutData(new GridData(3, 2, true, false));
      link.setFont(comp.getFont());
      link.setText(PropertiesMessages.ApiErrorWarningsPropertyPage_1);
      link.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          HashMap data = new HashMap();
          data.put("PropertyAndPreferencePage.nolink", Boolean.TRUE);
          SWTFactory.showPreferencePage(getShell(), "org.eclipse.pde.api.tools.ui.apitools.errorwarnings.prefpage", data);
        }
      });
    }
    block = new ApiErrorsWarningsConfigurationBlock(getProject(), (IWorkbenchPreferenceContainer)getContainer());
    block.createControl(comp);
    
    boolean ps = block.hasProjectSpecificSettings(getProject());
    pspecific.setSelection(ps);
    block.useProjectSpecificSettings(ps);
    if (link != null) {
      link.setEnabled(!ps);
    }
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IApiToolsHelpContextIds.APITOOLS_ERROR_WARNING_PROP_PAGE);
    return comp;
  }
  
  private boolean offerLink()
  {
    return (fPageData == null) || (!Boolean.TRUE.equals(fPageData.get("PropertyAndPreferencePage.nolink")));
  }
  
  private IProject getProject()
  {
    IAdaptable element = getElement();
    if ((element instanceof IJavaProject)) {
      return ((IJavaProject)element).getProject();
    }
    if ((element instanceof IProject)) {
      return (IProject)element;
    }
    return null;
  }
  
  public boolean performCancel()
  {
    block.performCancel();
    return super.performCancel();
  }
  
  public boolean performOk()
  {
    block.performOK();
    return super.performOk();
  }
  
  protected void performDefaults()
  {
    block.performDefaults();
    super.performDefaults();
  }
  
  protected void performApply()
  {
    block.performApply();
    super.performApply();
  }
  
  public void dispose()
  {
    block.dispose();
    super.dispose();
  }
  
  public void applyData(Object data)
  {
    if ((data instanceof HashMap))
    {
      fPageData = ((HashMap)data);
      if (link != null) {
        link.setVisible(!Boolean.TRUE.equals(fPageData.get("PropertyAndPreferencePage.nolink")));
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.properties.ApiErrorsWarningsPropertyPage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;

class ApiFiltersPropertyPage$1
  extends KeyAdapter
{
  final ApiFiltersPropertyPage this$0;
  
  ApiFiltersPropertyPage$1(ApiFiltersPropertyPage paramApiFiltersPropertyPage)
  {
    this$0 = paramApiFiltersPropertyPage;
  }
  
  public void keyPressed(KeyEvent e)
  {
    if ((character == '') && (stateMask == 0)) {
      this$0.handleRemove((IStructuredSelection)this$0.fViewer.getSelection());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.properties.ApiFiltersPropertyPage.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import java.util.ArrayList;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

class ApiFiltersPropertyPage$2
  extends ViewerFilter
{
  final ApiFiltersPropertyPage this$0;
  
  ApiFiltersPropertyPage$2(ApiFiltersPropertyPage paramApiFiltersPropertyPage)
  {
    this$0 = paramApiFiltersPropertyPage;
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    return !this$0.fDeleteSet.contains(element);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.properties.ApiFiltersPropertyPage.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemFilter;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;

class ApiFiltersPropertyPage$3
  implements ISelectionChangedListener
{
  final ApiFiltersPropertyPage this$0;
  
  ApiFiltersPropertyPage$3(ApiFiltersPropertyPage paramApiFiltersPropertyPage)
  {
    this$0 = paramApiFiltersPropertyPage;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    IStructuredSelection ss = (IStructuredSelection)event.getSelection();
    int size = ss.size();
    this$0.fRemoveButton.setEnabled(size > 0);
    if (size == 1)
    {
      Object element = ss.getFirstElement();
      if ((element instanceof IApiProblemFilter))
      {
        IApiProblemFilter filter = (IApiProblemFilter)element;
        String comment = filter.getComment();
        this$0.fEditButton.setEnabled(true);
        if (comment != null) {
          this$0.fCommentText.setText(comment);
        } else {
          this$0.fCommentText.setText("");
        }
      }
      else
      {
        this$0.fEditButton.setEnabled(false);
        this$0.fCommentText.setText("");
      }
    }
    else
    {
      this$0.fEditButton.setEnabled(false);
      this$0.fCommentText.setText("");
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.properties.ApiFiltersPropertyPage.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.ui.internal.properties;

import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemFilter;

class ApiFiltersPropertyPage$4
  implements IDoubleClickListener
{
  final ApiFiltersPropertyPage this$0;
  
  ApiFiltersPropertyPage$4(ApiFiltersPropertyPage paramApiFiltersPropertyPage)
  {
    this$0 = paramApiFiltersPropertyPage;
  }
 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd