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

ontext context, IWorkingCopyManager manager)
  {
    IEclipsePreferences node = context.getNode(qualifier);
    if (manager != null) {
      return manager.getWorkingCopy(node);
    }
    return node;
  }
  
  public String getStoredValue(IScopeContext context, IWorkingCopyManager manager)
  {
    IEclipsePreferences node = getNode(context, manager);
    if (node != null) {
      return node.get(key, null);
    }
    return null;
  }
  
  public String getStoredValue(IScopeContext[] lookupOrder, boolean ignoreTopScope, IWorkingCopyManager manager)
  {
    for (int i = ignoreTopScope ? 1 : 0; i < lookupOrder.length; i++)
    {
      String value = getStoredValue(lookupOrder[i], manager);
      if (value != null) {
        return value;
      }
    }
    return null;
  }
  
  public void setStoredValue(IScopeContext context, String value, IWorkingCopyManager manager)
  {
    IEclipsePreferences node = getNode(context, manager);
    if (value != null) {
      node.put(key, value);
    } else {
      node.remove(key);
    }
  }
  
  public String toString()
  {
    return qualifier + '/' + key;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiBaselinesConfigurationBlock.Key
 * 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.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.util.Util;
import org.eclipse.pde.api.tools.ui.internal.SWTFactory;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.eclipse.ui.preferences.IWorkingCopyManager;
import org.eclipse.ui.preferences.WorkingCopyManager;
import org.osgi.service.prefs.BackingStoreException;

public class ApiBaselinesConfigurationBlock
{
  protected static class ControlData
  {
    ApiBaselinesConfigurationBlock.Key key;
    private String[] values;
    
    public ControlData(ApiBaselinesConfigurationBlock.Key key, String[] values)
    {
      this.key = key;
      this.values = values;
    }
    
    public ApiBaselinesConfigurationBlock.Key getKey()
    {
      return key;
    }
    
    public String getValue(boolean selection)
    {
      int index = selection ? 0 : 1;
      return values[index];
    }
    
    public String getValue(int index)
    {
      return values[index];
    }
    
    public int getSelection(String value)
    {
      if (value != null) {
        for (int i = 0; i < values.length; i++) {
          if (value.equals(values[i])) {
            return i;
          }
        }
      }
      return values.length - 1;
    }
  }
  
  protected static class Key
  {
    private String qualifier;
    private String key;
    
    public Key(String qualifier, String key)
    {
      this.qualifier = qualifier;
      this.key = key;
    }
    
    private IEclipsePreferences getNode(IScopeContext context, IWorkingCopyManager manager)
    {
      IEclipsePreferences node = context.getNode(qualifier);
      if (manager != null) {
        return manager.getWorkingCopy(node);
      }
      return node;
    }
    
    public String getStoredValue(IScopeContext context, IWorkingCopyManager manager)
    {
      IEclipsePreferences node = getNode(context, manager);
      if (node != null) {
        return node.get(key, null);
      }
      return null;
    }
    
    public String getStoredValue(IScopeContext[] lookupOrder, boolean ignoreTopScope, IWorkingCopyManager manager)
    {
      for (int i = ignoreTopScope ? 1 : 0; i < lookupOrder.length; i++)
      {
        String value = getStoredValue(lookupOrder[i], manager);
        if (value != null) {
          return value;
        }
      }
      return null;
    }
    
    public void setStoredValue(IScopeContext context, String value, IWorkingCopyManager manager)
    {
      IEclipsePreferences node = getNode(context, manager);
      if (value != null) {
        node.put(key, value);
      } else {
        node.remove(key);
      }
    }
    
    public String toString()
    {
      return qualifier + '/' + key;
    }
  }
  
  protected static final Key getApiToolsKey(String key)
  {
    return new Key("org.eclipse.pde.api.tools", key);
  }
  
  private static final Key KEY_MISSING_DEFAULT_API_PROFILE = getApiToolsKey("missing_default_api_profile");
  private static Key[] fgAllKeys = {
    KEY_MISSING_DEFAULT_API_PROFILE };
  private static final String[] SEVERITIES_LABELS = {
    PreferenceMessages.ApiErrorsWarningsConfigurationBlock_error, 
    PreferenceMessages.ApiErrorsWarningsConfigurationBlock_warning, 
    PreferenceMessages.ApiErrorsWarningsConfigurationBlock_ignore };
  private static final String[] SEVERITIES = {
    "Error", 
    "Warning", 
    "Ignore" };
  private SelectionListener selectionlistener = new SelectionAdapter()
  {
    public void widgetSelected(SelectionEvent e)
    {
      if ((widget instanceof Combo))
      {
        Combo combo = (Combo)widget;
        ApiBaselinesConfigurationBlock.ControlData data = (ApiBaselinesConfigurationBlock.ControlData)combo.getData();
        key.setStoredValue(fLookupOrder[0], combo.getText(), fManager);
        fDirty = true;
        ApiBaselinePreferencePage.rebuildcount = 0;
      }
    }
  };
  private Combo fCombo = null;
  IScopeContext[] fLookupOrder = null;
  IWorkingCopyManager fManager = null;
  private Composite fMainComp = null;
  private IdentityHashMap fOldProjectSettings = null;
  boolean fDirty = false;
  private Composite fParent = null;
  
  public ApiBaselinesConfigurationBlock(IWorkbenchPreferenceContainer container)
  {
    fLookupOrder = new IScopeContext[] {
      InstanceScope.INSTANCE, 
      DefaultScope.INSTANCE };
    if (container == null) {
      fManager = new WorkingCopyManager();
    } else {
      fManager = container.getWorkingCopyManager();
    }
    fOldProjectSettings = null;
  }
  
  public Control createControl(Composite parent, ApiBaselinePreferencePage page)
  {
    fParent = parent;
    fMainComp = SWTFactory.createComposite(parent, 1, 1, 768, 0, 0);
    Group optionsProfileGroup = SWTFactory.createGroup(fMainComp, PreferenceMessages.ApiProfilesConfigurationBlock_options_group_title, 2, 1, 1808);
    fCombo = createComboControl(optionsProfileGroup, PreferenceMessages.ApiProfilesConfigurationBlock_missing_default_api_profile_message, KEY_MISSING_DEFAULT_API_PROFILE);
    Dialog.applyDialogFont(fMainComp);
    return fMainComp;
  }
  
  public void performOK()
  {
    save();
  }
  
  public void performApply()
  {
    save();
  }
  
  private void save()
  {
    if (fDirty) {
      try
      {
        ArrayList changes = new ArrayList();
        collectChanges(fLookupOrder[0], changes);
        if ((changes.size() > 0) && 
          (ApiBaselinePreferencePage.rebuildcount < 1))
        {
          ApiBaselinePreferencePage.rebuildcount += 1;
          fManager.applyChanges();
          String message = PreferenceMessages.ApiErrorsWarningsConfigurationBlock_0;
          IProject[] apiProjects = Util.getApiProjects();
          if (apiProjects != null) {
            if (MessageDialog.openQuestion(fParent.getShell(), PreferenceMessages.ApiErrorsWarningsConfigurationBlock_2, message)) {
              Util.getBuildJob(apiProjects).schedule();
            }
          }
        }
        fDirty = false;
      }
      catch (BackingStoreException bse)
      {
        ApiPlugin.log(bse);
      }
    }
  }
  
  public void performCancel() {}
  
  public void performDefaults()
  {
    String defval = null;
    for (int i = 0; i < fgAllKeys.length; i++)
    {
      defval = fgAllKeys[i].getStoredValue(fLookupOrder, true, fManager);
      fgAllKeys[i].setStoredValue(fLookupOrder[0], defval, fManager);
    }
    updateCombos();
    fDirty = true;
  }
  
  private void updateCombos()
  {
    if (fCombo != null)
    {
      ControlData data = (ControlData)fCombo.getData();
      fCombo.select(data.getSelection(data.getKey().getStoredValue(fLookupOrder, false, fManager)));
    }
  }
  
  public void dispose()
  {
    fMainComp.getParent().dispose();
  }
  
  protected Combo createComboControl(Composite parent, String label, Key key)
  {
    Label lbl = new Label(parent, 0);
    GridData gd = new GridData(1, 2, true, false);
    lbl.setLayoutData(gd);
    lbl.setText(label);
    Combo combo = new Combo(parent, 12);
    gd = new GridData(3, 2, false, false);
    combo.setLayoutData(gd);
    ControlData data = new ControlData(key, SEVERITIES);
    combo.setData(data);
    combo.setItems(SEVERITIES_LABELS);
    combo.addSelectionListener(selectionlistener);
    combo.select(data.getSelection(key.getStoredValue(fLookupOrder, false, fManager)));
    return combo;
  }
  
  private void collectChanges(IScopeContext context, List changes)
  {
    Key key = null;
    String origval = null;
    String newval = null;
    boolean complete = fOldProjectSettings == null;
    for (int i = 0; i < fgAllKeys.length; i++)
    {
      key = fgAllKeys[i];
      origval = key.getStoredValue(context, null);
      newval = key.getStoredValue(context, fManager);
      if (newval == null)
      {
        if (origval != null)
        {
          changes.add(key);
        }
        else if (complete)
        {
          key.setStoredValue(context, key.getStoredValue(fLookupOrder, true, fManager), fManager);
          changes.add(key);
        }
      }
      else if (!newval.equals(origval)) {
        changes.add(key);
      }
    }
  }
  
  public static Key[] getAllKeys()
  {
    return fgAllKeys;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiBaselinesConfigurationBlock
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Widget;

class ApiErrorsWarningsConfigurationBlock$1
  extends SelectionAdapter
{
  final ApiErrorsWarningsConfigurationBlock this$0;
  
  ApiErrorsWarningsConfigurationBlock$1(ApiErrorsWarningsConfigurationBlock paramApiErrorsWarningsConfigurationBlock)
  {
    this$0 = paramApiErrorsWarningsConfigurationBlock;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    Widget widget = widget;
    ApiErrorsWarningsConfigurationBlock.ControlData data = (ApiErrorsWarningsConfigurationBlock.ControlData)widget.getData();
    ApiErrorsWarningsConfigurationBlock.Key key = data.getKey();
    String newValue = null;
    if ((widget instanceof Button)) {
      newValue = data.getValue(((Button)widget).getSelection());
    } else if ((widget instanceof Combo)) {
      newValue = data.getValue(((Combo)widget).getSelectionIndex());
    } else {
      return;
    }
    String oldValue = this$0.setValue(key, newValue);
    this$0.validateSettings(key, oldValue, newValue);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.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.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ApiErrorsWarningsConfigurationBlock$2
  implements Listener
{
  final ApiErrorsWarningsConfigurationBlock this$0;
  
  ApiErrorsWarningsConfigurationBlock$2(ApiErrorsWarningsConfigurationBlock paramApiErrorsWarningsConfigurationBlock)
  {
    this$0 = paramApiErrorsWarningsConfigurationBlock;
  }
  
  public void handleEvent(Event event)
  {
    this$0.handleExpand(this$0.getScrollingParent(widget));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.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.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ApiErrorsWarningsConfigurationBlock$3
  implements Listener
{
  final ApiErrorsWarningsConfigurationBlock this$0;
  
  ApiErrorsWarningsConfigurationBlock$3(ApiErrorsWarningsConfigurationBlock paramApiErrorsWarningsConfigurationBlock)
  {
    this$0 = paramApiErrorsWarningsConfigurationBlock;
  }
  
  public void handleEvent(Event event)
  {
    this$0.handleExpand(this$0.getScrollingParent(widget));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.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.core.commands.Command;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerService;

class ApiErrorsWarningsConfigurationBlock$4
  extends SelectionAdapter
{
  final ApiErrorsWarningsConfigurationBlock this$0;
  private final Command val$command;
  
  ApiErrorsWarningsConfigurationBlock$4(ApiErrorsWarningsConfigurationBlock paramApiErrorsWarningsConfigurationBlock, Command paramCommand)
  {
    this$0 = paramApiErrorsWarningsConfigurationBlock;val$command = paramCommand;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    Class tmp6_3 = ApiErrorsWarningsConfigurationBlock.class$1;
    if (tmp6_3 == null)
    {
      tmp6_3;
      try
      {
        tmpTernaryOp = (ApiErrorsWarningsConfigurationBlock.class$1 = Class.forName("org.eclipse.ui.handlers.IHandlerService"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(tmp6_3);
    if (handlerService != null) {
      try
      {
        val$command.executeWithChecks(handlerService.createExecutionEvent(val$command, null));
      }
      catch (ExecutionException localExecutionException)
      {
        MessageDialog.openError(
          ApiUIPlugin.getShell(), 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_title, 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_description);
      }
      catch (NotDefinedException localNotDefinedException)
      {
        MessageDialog.openError(
          ApiUIPlugin.getShell(), 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_title, 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_description);
      }
      catch (NotEnabledException localNotEnabledException)
      {
        MessageDialog.openError(
          ApiUIPlugin.getShell(), 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_title, 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_description);
      }
      catch (NotHandledException localNotHandledException)
      {
        MessageDialog.openError(
          ApiUIPlugin.getShell(), 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_title, 
          PreferenceMessages.ApiProblemSeveritiesConfigurationBlock_checkable_ees_error_dialog_description);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.4
 * 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.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;

class ApiErrorsWarningsConfigurationBlock$5
  extends ExpansionAdapter
{
  final ApiErrorsWarningsConfigurationBlock this$0;
  
  ApiErrorsWarningsConfigurationBlock$5(ApiErrorsWarningsConfigurationBlock paramApiErrorsWarningsConfigurationBlock)
  {
    this$0 = paramApiErrorsWarningsConfigurationBlock;
  }
  
  public void expansionStateChanged(ExpansionEvent e)
  {
    Object obj = e.getSource();
    this$0.handleExpand(this$0.getScrollingParent(obj));
  }
}

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

public class ApiErrorsWarningsConfigurationBlock$ControlData
{
  private ApiErrorsWarningsConfigurationBlock.Key key;
  private String[] values;
  
  public ApiErrorsWarningsConfigurationBlock$ControlData(ApiErrorsWarningsConfigurationBlock.Key key, String[] values)
  {
    this.key = key;
    this.values = values;
  }
  
  public ApiErrorsWarningsConfigurationBlock.Key getKey()
  {
    return key;
  }
  
  public String getValue(boolean selection)
  {
    int index = selection ? 0 : 1;
    return values[index];
  }
  
  public String getValue(int index)
  {
    return values[index];
  }
  
  public int getSelection(String value)
  {
    if (value != null) {
      for (int i = 0; i < values.length; i++) {
        if (value.equals(values[i])) {
          return i;
        }
      }
    }
    return values.length - 1;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.ControlData
 * 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.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.ui.preferences.IWorkingCopyManager;

public class ApiErrorsWarningsConfigurationBlock$Key
{
  private String qualifier;
  private String key;
  
  public ApiErrorsWarningsConfigurationBlock$Key(String qualifier, String key)
  {
    this.qualifier = qualifier;
    this.key = key;
  }
  
  private IEclipsePreferences getNode(IScopeContext context, IWorkingCopyManager manager)
  {
    IEclipsePreferences node = context.getNode(qualifier);
    if (manager != null) {
      return manager.getWorkingCopy(node);
    }
    return node;
  }
  
  public String getStoredValue(IScopeContext context, IWorkingCopyManager manager)
  {
    IEclipsePreferences node = getNode(context, manager);
    if (node != null) {
      return node.get(key, null);
    }
    return null;
  }
  
  public String getStoredValue(IScopeContext[] lookupOrder, boolean ignoreTopScope, IWorkingCopyManager manager)
  {
    for (int i = ignoreTopScope ? 1 : 0; i < lookupOrder.length; i++)
    {
      String value = getStoredValue(lookupOrder[i], manager);
      if (value != null) {
        return value;
      }
    }
    return null;
  }
  
  public void setStoredValue(IScopeContext context, String value, IWorkingCopyManager manager)
  {
    IEclipsePreferences node = getNode(context, manager);
    if (value != null) {
      node.put(key, value);
    } else {
      node.remove(key);
    }
  }
  
  public String toString()
  {
    return qualifier + '/' + key;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.ui.internal.preferences.ApiErrorsWarningsConfigurationBlock.Key
 * 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.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ApiErrorsWarningsConfigurationBlock$SetAllSelectionAdapter
  extends SelectionAdapter
{
  String newValue;
  int kind;
  final ApiErrorsWarningsConfigurationBlock this$0;
  
  public ApiErrorsWarningsConfigurationBlock$SetAllSelectionAdapter(ApiErrorsWarningsConfigurationBlock paramApiErrorsWarningsConfigurationBlock, int kind, String newValue)
  {
    this$0 = paramApiErrorsWarningsConfigurationBlock;
    this.kind = kind;
    this.newValue = newValue;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    switch (kind)
    {
    case 0: 
      this$0.setAllTo(newValue, ApiErrorsWarningsConfigurationBlock.fgAllApiScanningKeys);
      break;
    case 2: 
      this$0.setAllTo(newValue, ApiErrorsWarningsConfigurationBlock.fgAllVersionManagementKeys);
      break;
    case 1: 
      this$0.setAllTo(newValue, ApiErrorsWarningsConfigurationBlock.fgAllCompatibilityKeys);
      break;
    case 3: 
      this$0.setAllTo(newValue, ApiErrorsWarningsConfigurationBlock.fgAllApiComponentResolutionKeys);
      break;
    case 4: 
      this$0.setAllTo(newValue, ApiErrorsWarningsConfigurationBlock.fgAllExternalDependenciesKeys);
    }
  }
}

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

import com.ibm.icu.text.MessageFormat;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.NotEnabledException;
import org.eclipse.core.commands.NotHandledException;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.pde.api.tools.internal.model.StubApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.ProfileModifiers;
import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemTypes;
import org.eclipse.pde.api.tools.internal.util.Util;
import org.eclipse.pde.api.tools.ui.internal.ApiUIPlugin;
import org.eclipse.pde.api.tools.ui.internal.SWTFactory;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.eclipse.ui.preferences.IWorkingCopyManager;
import org.eclipse.ui.preferences.WorkingCopyManager;
import org.osgi.service.prefs.BackingStoreException;

public class ApiErrorsWarningsConfigurationBlock
{
  private static final String P2_INSTALL_COMMAND_HANDLER = "org.eclipse.equinox.p2.ui.sdk.install";
  
  protected static class ControlData
  {
    private ApiErrorsWarningsConfigurationBlock.Key key;
    private String[] values;
    
    public ControlData(ApiErrorsWarningsConfigurationBlock.Key key, String[] values)
    {
      this.key = key;
      this.values = values;
    }
    
    public ApiErrorsWarningsConfigurationBlock.Key getKey()
    {
      return key;
    }
    
    public String getValue(boolean selection)
    {
      int index = selection ? 0 : 1;
      return values[index];
    }
    
    public String getValue(int index)
    {
      return values[index];
    }
    
    public int getSelection(String value)
    {
      if (value != null) {
        for (int i = 0; i < values.length; i++) {
          if (value.equals(values[i])) {
            return i;
          }
        }
      }
      return values.length - 1;
    }
  }
  
  protected static class Key
  {
    private String qualifier;
    private String key;
    
    public Key(String qualifier, String key)
    {
      this.qualifier = qualifier;
      this.key = key;
    }
    
    private IEclipsePreferences getNode(IScopeContext context, IWorkingCopyManager manager)
    {
      IEclipsePreferences node = context.getNode(qualifier);
      if (manager != null) {
        return manager.getWorkingCopy(node);
      }
      return node;
    }
    
    public String getStoredValue(IScopeContext context, IWorkingCopyManager manager)
    {
      IEclipsePreferences node = getNode(context, manager);
      if (node != null) {
        return node.get(key, null);
      }
      return null;
    }
    
    public String getStoredValue(IScopeContext[] lookupOrder, boolean ignoreTopScope, IWorkingCopyManager manager)
    {
      for (int i = ignoreTopScope ? 1 : 0; i < lookupOrder.length; i++)
      {
        String value = getStoredValue(lookupOrder[i], manager);
        if (value != null) {
          return value;
        }
      }
      return null;
    }
    
    public void setStoredValue(IScopeContext context, String value, IWorkingCopyManager manager)
    {
      IEclipsePreferences node = getNode(context, manager);
      if (value != null) {
        node.put(key, value);
      } else {
        node.remove(key);
      }
    }
    
    public String toString()
    {
      return qualifier + '/' + key;
    }
  }
  
  protected static final Key getApiToolsKey(String key)
  {
    return new Key("org.eclipse.pde.api.tools", key);
  }
  
  private static final Key KEY_NOIMPLEMENT = getApiToolsKey("ILLEGAL_IMPLEMENT");
  private static final Key KEY_NOEXTEND = getApiToolsKey("ILLEGAL_EXTEND");
  private static final Key KEY_NOINSTANTIATE = getApiToolsKey("ILLEGAL_INSTANTIATE");
  private static final Key KEY_NOREFERENCE = getApiToolsKey("ILLEGAL_REFERENCE");
  private static final Key KEY_NOOVERRIDE = getApiToolsKey("ILLEGAL_OVERRIDE");
  private static final Key KEY_LEAK_EXTEND = getApiToolsKey("LEAK_EXTEND");
  private static final Key KEY_LEAK_IMPLEMENT = getApiToolsKey("LEAK_IMPLEMENT");
  private static final Key KEY_LEAK_METHOD_RETURN_TYPE = getApiToolsKey("LEAK_METHOD_RETURN_TYPE");
  private static final Key KEY_LEAK_FIELD_DECL = getApiToolsKey("LEAK_FIELD_DECL");
  private static final Key KEY_LEAK_METHOD_PARAM = getApiToolsKey("LEAK_METHOD_PARAM");
  private static final Key KEY_INVALID_JAVADOC_TAG = getApiToolsKey("INVALID_JAVADOC_TAG");
  private static final Key KEY_INVALID_REFERENCE_IN_SYSTEM_LIBRARIES = getApiToolsKey("INVALID_REFERENCE_IN_SYSTEM_LIBRARIES");
  private static final Key KEY_UNUSED_PROBLEM_FILTERS = getApiToolsKey("UNUSED_PROBLEM_FILTERS");
  private static final Key KEY_API_COMPONENT_REMOVED_API_TYPE = getApiToolsKey(IApiProblemTypes.API_COMPONENT_REMOVED_API_TYPE);
  private static final Key KEY_API_COMPONENT_REMOVED_TYPE = getApiToolsKey(IApiProblemTypes.API_COMPONENT_REMOVED_TYPE);
  private static final Key KEY_API_COMPONENT_REMOVED_REEXPORTED_API_TYPE = getApiToolsKey(IApiProblemTypes.API_COMPONENT_REMOVED_REEXPORTED_API_TYPE);
  private static final Key KEY_API_COMPONENT_REMOVED_REEXPORTED_TYPE = getApiToolsKey(IApiProblemTypes.API_COMPONENT_REMOVED_REEXPORTED_TYPE);
  private static final Key KEY_ANNOTATION_ADDED_METHOD_NO_DEFAULT_VALUE = getApiToolsKey(IApiProblemTypes.ANNOTATION_ADDED_METHOD_NO_DEFAULT_VALUE);
  private static final Key KEY_ANNOTATION_REMOVED_FIELD = getApiToolsKey(IApiProblemTypes.ANNOTATION_REMOVED_FIELD);
  private static final Key KEY_ANNOTATION_REMOVED_METHOD = getApiToolsKey(IApiProblemTypes.ANNOTATION_REMOVED_METHOD);
  private static final Key KEY_ANNOTATION_REMOVED_TYPE_MEMBER = getApiToolsKey(IApiProblemTypes.ANNOTATION_REMOVED_TYPE_MEMBER);
  private static final Key KEY_ANNOTATION_CHANGED_TYPE_CONVERSION = getApiToolsKey(IApiProblemTypes.ANNOTATION_CHANGED_TYPE_CONVERSION);
  private static final Key KEY_INTERFACE_ADDED_FIELD = getApiToolsKey(IApiProblemTypes.INTERFACE_ADDED_FIELD);
  private static final Key KEY_INTERFACE_ADDED_METHOD = getApiToolsKey(IApiProblemTypes.INTERFACE_ADDED_METHOD);
  private static final Key KEY_INTERFACE_ADDED_RESTRICTIONS = getApiToolsKey(IApiProblemTypes.INTERFACE_ADDED_RESTRICTIONS);
  private static final Key KEY_INTERFACE_ADDED_SUPER_INTERFACE_WITH_METHODS = getApiToolsKey(IApiProblemTypes.INTERFACE_ADDED_SUPER_INTERFACE_WITH_METHODS);
  private static final Key KEY_INTERFACE_ADDED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.INTERFACE_ADDED_TYPE_PARAMETER);
  private static final Key KEY_INTERFACE_REMOVED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.INTERFACE_REMOVED_TYPE_PARAMETER);
  private static final Key KEY_INTERFACE_REMOVED_FIELD = getApiToolsKey(IApiProblemTypes.INTERFACE_REMOVED_FIELD);
  private static final Key KEY_INTERFACE_REMOVED_METHOD = getApiToolsKey(IApiProblemTypes.INTERFACE_REMOVED_METHOD);
  private static final Key KEY_INTERFACE_REMOVED_TYPE_MEMBER = getApiToolsKey(IApiProblemTypes.INTERFACE_REMOVED_TYPE_MEMBER);
  private static final Key KEY_INTERFACE_CHANGED_TYPE_CONVERSION = getApiToolsKey(IApiProblemTypes.INTERFACE_CHANGED_TYPE_CONVERSION);
  private static final Key KEY_INTERFACE_CHANGED_CONTRACTED_SUPERINTERFACES_SET = getApiToolsKey(IApiProblemTypes.INTERFACE_CHANGED_CONTRACTED_SUPERINTERFACES_SET);
  private static final Key KEY_ENUM_CHANGED_CONTRACTED_SUPERINTERFACES_SET = getApiToolsKey(IApiProblemTypes.ENUM_CHANGED_CONTRACTED_SUPERINTERFACES_SET);
  private static final Key KEY_ENUM_CHANGED_TYPE_CONVERSION = getApiToolsKey(IApiProblemTypes.ENUM_CHANGED_TYPE_CONVERSION);
  private static final Key KEY_ENUM_REMOVED_FIELD = getApiToolsKey(IApiProblemTypes.ENUM_REMOVED_FIELD);
  private static final Key KEY_ENUM_REMOVED_ENUM_CONSTANT = getApiToolsKey(IApiProblemTypes.ENUM_REMOVED_ENUM_CONSTANT);
  private static final Key KEY_ENUM_REMOVED_METHOD = getApiToolsKey(IApiProblemTypes.ENUM_REMOVED_METHOD);
  private static final Key KEY_ENUM_REMOVED_TYPE_MEMBER = getApiToolsKey(IApiProblemTypes.ENUM_REMOVED_TYPE_MEMBER);
  private static final Key KEY_CLASS_ADDED_METHOD = getApiToolsKey(IApiProblemTypes.CLASS_ADDED_METHOD);
  private static final Key KEY_CLASS_ADDED_RESTRICTIONS = getApiToolsKey(IApiProblemTypes.CLASS_ADDED_RESTRICTIONS);
  private static final Key KEY_CLASS_ADDED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.CLASS_ADDED_TYPE_PARAMETER);
  private static final Key KEY_CLASS_CHANGED_CONTRACTED_SUPERINTERFACES_SET = getApiToolsKey(IApiProblemTypes.CLASS_CHANGED_CONTRACTED_SUPERINTERFACES_SET);
  private static final Key KEY_CLASS_CHANGED_NON_ABSTRACT_TO_ABSTRACT = getApiToolsKey(IApiProblemTypes.CLASS_CHANGED_NON_ABSTRACT_TO_ABSTRACT);
  private static final Key KEY_CLASS_CHANGED_NON_FINAL_TO_FINAL = getApiToolsKey(IApiProblemTypes.CLASS_CHANGED_NON_FINAL_TO_FINAL);
  private static final Key KEY_CLASS_CHANGED_TYPE_CONVERSION = getApiToolsKey(IApiProblemTypes.CLASS_CHANGED_TYPE_CONVERSION);
  private static final Key KEY_CLASS_CHANGED_DECREASE_ACCESS = getApiToolsKey(IApiProblemTypes.CLASS_CHANGED_DECREASE_ACCESS);
  private static final Key KEY_CLASS_REMOVED_FIELD = getApiToolsKey(IApiProblemTypes.CLASS_REMOVED_FIELD);
  private static final Key KEY_CLASS_REMOVED_METHOD = getApiToolsKey(IApiProblemTypes.CLASS_REMOVED_METHOD);
  private static final Key KEY_CLASS_REMOVED_CONSTRUCTOR = getApiToolsKey(IApiProblemTypes.CLASS_REMOVED_CONSTRUCTOR);
  private static final Key KEY_CLASS_REMOVED_SUPERCLASS = getApiToolsKey(IApiProblemTypes.CLASS_REMOVED_SUPERCLASS);
  private static final Key KEY_CLASS_REMOVED_TYPE_MEMBER = getApiToolsKey(IApiProblemTypes.CLASS_REMOVED_TYPE_MEMBER);
  private static final Key KEY_CLASS_REMOVED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.CLASS_REMOVED_TYPE_PARAMETER);
  private static final Key KEY_FIELD_ADDED_VALUE = getApiToolsKey(IApiProblemTypes.FIELD_ADDED_VALUE);
  private static final Key KEY_FIELD_CHANGED_TYPE = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_TYPE);
  private static final Key KEY_FIELD_CHANGED_VALUE = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_VALUE);
  private static final Key KEY_FIELD_CHANGED_DECREASE_ACCESS = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_DECREASE_ACCESS);
  private static final Key KEY_FIELD_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT);
  private static final Key KEY_FIELD_CHANGED_NON_FINAL_TO_FINAL = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_NON_FINAL_TO_FINAL);
  private static final Key KEY_FIELD_CHANGED_STATIC_TO_NON_STATIC = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_STATIC_TO_NON_STATIC);
  private static final Key KEY_FIELD_CHANGED_NON_STATIC_TO_STATIC = getApiToolsKey(IApiProblemTypes.FIELD_CHANGED_NON_STATIC_TO_STATIC);
  private static final Key KEY_FIELD_REMOVED_VALUE = getApiToolsKey(IApiProblemTypes.FIELD_REMOVED_VALUE);
  private static final Key KEY_FIELD_REMOVED_TYPE_ARGUMENT = getApiToolsKey(IApiProblemTypes.FIELD_REMOVED_TYPE_ARGUMENT);
  private static final Key KEY_METHOD_ADDED_RESTRICTIONS = getApiToolsKey(IApiProblemTypes.METHOD_ADDED_RESTRICTIONS);
  private static final Key KEY_METHOD_ADDED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.METHOD_ADDED_TYPE_PARAMETER);
  private static final Key KEY_METHOD_CHANGED_VARARGS_TO_ARRAY = getApiToolsKey(IApiProblemTypes.METHOD_CHANGED_VARARGS_TO_ARRAY);
  private static final Key KEY_METHOD_CHANGED_DECREASE_ACCESS = getApiToolsKey(IApiProblemTypes.METHOD_CHANGED_DECREASE_ACCESS);
  private static final Key KEY_METHOD_CHANGED_NON_ABSTRACT_TO_ABSTRACT = getApiToolsKey(IApiProblemTypes.METHOD_CHANGED_NON_ABSTRACT_TO_ABSTRACT);
  private static final Key KEY_METHOD_CHANGED_NON_STATIC_TO_STATIC = getApiToolsKey(IApiProblemTypes.METHOD_CHANGED_NON_STATIC_TO_STATIC);
  private static final Key KEY_METHOD_CHANGED_STATIC_TO_NON_STATIC = getApiToolsKey(IApiProblemTypes.METHOD_CHANGED_STATIC_TO_NON_STATIC);
  private static final Key KEY_METHOD_CHANGED_NON_FINAL_TO_FINAL = getApiToolsKey(IApiProblemTypes.METHOD_CHANGED_NON_FINAL_TO_FINAL);
  private static final Key KEY_METHOD_REMOVED_ANNOTATION_DEFAULT_VALUE = getApiToolsKey(IApiProblemTypes.METHOD_REMOVED_ANNOTATION_DEFAULT_VALUE);
  private static final Key KEY_METHOD_REMOVED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.METHOD_REMOVED_TYPE_PARAMETER);
  private static final Key KEY_CONSTRUCTOR_ADDED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.CONSTRUCTOR_ADDED_TYPE_PARAMETER);
  private static final Key KEY_CONSTRUCTOR_CHANGED_VARARGS_TO_ARRAY = getApiToolsKey(IApiProblemTypes.CONSTRUCTOR_CHANGED_VARARGS_TO_ARRAY);
  private static final Key KEY_CONSTRUCTOR_CHANGED_DECREASE_ACCESS = getApiToolsKey(IApiProblemTypes.CONSTRUCTOR_CHANGED_DECREASE_ACCESS);
  private static final Key KEY_CONSTRUCTOR_REMOVED_TYPE_PARAMETER = getApiToolsKey(IApiProblemTypes.CONSTRUCTOR_REMOVED_TYPE_PARAMETER);
  private static final Key KEY_TYPE_PARAMETER_ADDED_CLASS_BOUND = getApiToolsKey(IApiProblemTypes.TYPE_PARAMETER_ADDED_CLASS_BOUND);
  private static final Key KEY_TYPE_PARAMETER_CHANGED_CLASS_BOUND = getApiToolsKey(IApiProblemTypes.TYPE_PARAMETER_CHANGED_CLASS_BOUND);
  private static final Key KEY_TYPE_PARAMETER_REMOVED_CLASS_BOUND = getApiToolsKey(IApiProblemTypes.TYPE_PARAMETER_REMOVED_CLASS_BOUND);
  private static final Key KEY_TYPE_PARAMETER_ADDED_INTERFACE_BOUND = getApiToolsKey(IApiProblemTypes.TYPE_PARAMETER_ADDED_INTERFACE_BOUND);
  private static final Key KEY_TYPE_PARAMETER_CHANGED_INTERFACE_BOUND = getApiToolsKey(IApiProblemTypes.TYPE_PARAMETER_CHANGED_INTERFACE_BOUND);
  private static final Key KEY_TYPE_PARAMETER_REMOVED_INTERFACE_BOUND = getApiToolsKey(IApiProblemTypes.TYPE_PARAMETER_REMOVED_INTERFACE_BOUND);
  private static final Key KEY_MISSING_SINCE_TAG = getApiToolsKey("missing_since_tag");
  private static final Key KEY_MALFORMED_SINCE_TAG = getApiToolsKey("malformed_since_tag");
  private static final Key KEY_INVALID_SINCE_TAG_VERSION = getApiToolsKey("invalid_since_tag_version");
  private static final Key KEY_INCOMPATIBLE_API_COMPONENT_VERSION = getApiToolsKey("incompatible_api_component_version");
  private static final Key KEY_INCOMPATIBLE_API_COMPONENT_VERSION_INCLUDE_INCLUDE_MINOR_WITHOUT_API_CHANGE = getApiToolsKey("incompatible_api_component_version_include_minor_without_api_change");
  private static final Key KEY_INCOMPATIBLE_API_COMPONENT_VERSION_INCLUDE_INCLUDE_MAJOR_WITHOUT_BREAKING_CHANGE = getApiToolsKey("incompatible_api_component_version_include_major_without_breaking_change");
  private static final Key KEY_REPORT_API_BREAKAGE_WHEN_MAJOR_VERSION_INCREMENTED = getApiToolsKey("report_api_breakage_when_major_version_incremented");
  private static final Key KEY_REPORT_RESOLUTION_ERRORS_API_COMPONENT = getApiToolsKey("report_resolution_errors_api_component");
  private static final Key KEY_API_USE_SCAN_TYPE_PROBLEM = getApiToolsKey("API_USE_SCAN_TYPE_SEVERITY");
  private static final Key KEY_API_USE_SCAN_METHOD_PROBLEM = getApiToolsKey("API_USE_SCAN_METHOD_SEVERITY");
  private static final Key KEY_API_USE_SCAN_FIELD_PROBLEM = getApiToolsKey("API_USE_SCAN_FIELD_SEVERITY");
  private static final Key KEY_AUTOMATICALLY_REMOVE_PROBLEM_FILTERS = getApiToolsKey("automatically_removed_unused_problem_filters");
  public static final int API_SCANNING_USAGE_PAGE_ID = 0;
  public static final int COMPATIBILITY_PAGE_ID = 1;
  public static final int VERSION_MANAGEMENT_PAGE_ID = 2;
  public static final int API_COMPONENT_RESOLUTION_PAGE_ID = 3;
  public static final int API_USE_SCANS_PAGE_ID = 4;
  static Key[] fgAllApiComponentResolutionKeys = {
    KEY_REPORT_RESOLUTION_ERRORS_API_COMPONENT, 
    KEY_UNUSED_PROBLEM_FILTERS, 
    KE
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