org.eclipse.mylyn.oslc.ui_3.7.1.v20120425-0100

16:46:48.521 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.oslc.ui_3.7.1.v20120425-0100.jar
package org.eclipse.mylyn.internal.oslc.ui;

import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;

public class OslcServiceDiscoveryWizardDialog
  extends WizardDialog
{
  public OslcServiceDiscoveryWizardDialog(Shell parentShell, IWizard newWizard)
  {
    super(parentShell, newWizard);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcServiceDiscoveryWizardDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import java.util.List;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.internal.oslc.core.IOslcConnector;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.tasks.core.TaskRepository;

public class OslcServiceDiscoveryWizard
  extends Wizard
{
  private final IOslcConnector connector;
  private final TaskRepository repository;
  private OslcServiceDiscoveryWizardPage page;
  private final List<OslcServiceProvider> providers;
  
  public OslcServiceDiscoveryWizard(IOslcConnector connector, TaskRepository repository, List<OslcServiceProvider> providers)
  {
    setNeedsProgressMonitor(true);
    this.connector = connector;
    this.repository = repository;
    this.providers = providers;
  }
  
  public boolean performFinish()
  {
    return true;
  }
  
  public void addPages()
  {
    page = new OslcServiceDiscoveryWizardPage(connector, repository);
    page.setRootProviders(providers);
    addPage(page);
  }
  
  public boolean canFinish()
  {
    return page.getSelectedServiceProvider() != null;
  }
  
  public OslcServiceDescriptor getSelectedServiceDescriptor()
  {
    return page.getSelectedServiceProvider();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcServiceDiscoveryWizard
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.oslc.core.OslcCreationDialogDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProviderCatalog;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.swt.graphics.Image;

public class OslcServiceLabelProvider
  extends LabelProvider
{
  public String getText(Object element)
  {
    if ((element instanceof OslcServiceProvider)) {
      return ((OslcServiceProvider)element).getName();
    }
    if ((element instanceof OslcCreationDialogDescriptor)) {
      return ((OslcCreationDialogDescriptor)element).getTitle();
    }
    if ((element instanceof OslcServiceDescriptor)) {
      return ((OslcServiceDescriptor)element).getDescription();
    }
    if ((element instanceof OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper)) {
      return getText(((OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper)element).getServiceObject());
    }
    return Messages.OslcServiceLabelProvider_Loading;
  }
  
  public Image getImage(Object element)
  {
    if ((element instanceof OslcServiceProviderCatalog)) {
      return CommonImages.getImage(TasksUiImages.REPOSITORIES_VIEW);
    }
    if ((element instanceof OslcServiceProvider)) {
      return CommonImages.getImage(TasksUiImages.REPOSITORY);
    }
    if ((element instanceof OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper)) {
      return getImage(((OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper)element).getServiceObject());
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcServiceLabelProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import java.util.List;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.internal.oslc.core.IOslcConnector;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProviderCatalog;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.ui.progress.DeferredTreeContentManager;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;

public class OslcServiceDiscoveryProvider
  implements ITreeContentProvider
{
  private final IOslcConnector connector;
  private final TaskRepository repository;
  private OslcServiceProvider selectedPovider;
  private DeferredTreeContentManager manager;
  
  OslcServiceDiscoveryProvider(IOslcConnector connector, TaskRepository repository, String base)
  {
    this.connector = connector;
    this.repository = repository;
  }
  
  public Object[] getChildren(Object parentElement)
  {
    return manager.getChildren(parentElement);
  }
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public OslcServiceProvider getOSLServiceProvider()
  {
    return selectedPovider;
  }
  
  public boolean hasChildren(Object element)
  {
    return manager.mayHaveChildren(element);
  }
  
  public Object[] getElements(Object inputElement)
  {
    if ((inputElement instanceof List))
    {
      List<OslcServiceProvider> rootProviders = (List)inputElement;
      Object[] result = new Object[rootProviders.size()];
      for (int x = 0; x < rootProviders.size(); x++) {
        result[x] = new ServiceProviderCatalogWrapper(rootProviders.get(x));
      }
      return result;
    }
    Object[] result = { inputElement };
    return result;
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
  {
    if ((viewer instanceof AbstractTreeViewer)) {
      manager = new DeferredTreeContentManager(null, (AbstractTreeViewer)viewer);
    }
  }
  
  protected class ServiceProviderCatalogWrapper
    implements IDeferredWorkbenchAdapter
  {
    private final Object element;
    
    public ServiceProviderCatalogWrapper(Object catalog)
    {
      element = catalog;
    }
    
    /* Error */
    public void fetchDeferredChildren(Object object, org.eclipse.ui.progress.IElementCollector collector, org.eclipse.core.runtime.IProgressMonitor monitor)
    {
      // Byte code:
      //   0: aload_3
      //   1: invokeinterface 154 1 0
      //   6: ifne +235 -> 241
      //   9: aload_3
      //   10: ldc 3
      //   12: iconst_m1
      //   13: invokeinterface 155 3 0
      //   18: aload_1
      //   19: checkcast 79	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
      //   22: astore 4
      //   24: aload 4
      //   26: invokevirtual 148	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:getServiceObject	()Ljava/lang/Object;
      //   29: astore 5
      //   31: aload 5
      //   33: instanceof 77
      //   36: ifeq +94 -> 130
      //   39: aload 5
      //   41: checkcast 77	org/eclipse/mylyn/internal/oslc/core/OslcServiceProviderCatalog
      //   44: astore 6
      //   46: aload_0
      //   47: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   50: invokestatic 144	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$0	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/internal/oslc/core/IOslcConnector;
      //   53: aload_0
      //   54: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   57: invokestatic 147	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$1	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/tasks/core/TaskRepository;
      //   60: aload 6
      //   62: invokevirtual 143	org/eclipse/mylyn/internal/oslc/core/OslcServiceProviderCatalog:getUrl	()Ljava/lang/String;
      //   65: aload_3
      //   66: invokeinterface 156 4 0
      //   71: astore 7
      //   73: aload 7
      //   75: invokeinterface 152 1 0
      //   80: astore 9
      //   82: goto +35 -> 117
      //   85: aload 9
      //   87: invokeinterface 151 1 0
      //   92: checkcast 76	org/eclipse/mylyn/internal/oslc/core/OslcServiceProvider
      //   95: astore 8
      //   97: aload_2
      //   98: new 79	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
      //   101: dup
      //   102: aload_0
      //   103: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   106: aload 8
      //   108: invokespecial 149	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:<init>	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;Ljava/lang/Object;)V
      //   111: aload_3
      //   112: invokeinterface 158 3 0
      //   117: aload 9
      //   119: invokeinterface 150 1 0
      //   124: ifne -39 -> 85
      //   127: goto +114 -> 241
      //   130: aload 5
      //   132: instanceof 76
      //   135: ifeq +106 -> 241
      //   138: aload_0
      //   139: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   142: aload 5
      //   144: checkcast 76	org/eclipse/mylyn/internal/oslc/core/OslcServiceProvider
      //   147: invokestatic 146	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$2	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;Lorg/eclipse/mylyn/internal/oslc/core/OslcServiceProvider;)V
      //   150: aload_0
      //   151: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   154: invokestatic 144	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$0	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/internal/oslc/core/IOslcConnector;
      //   157: aload_0
      //   158: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   161: invokestatic 147	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$1	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/tasks/core/TaskRepository;
      //   164: aload_0
      //   165: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   168: invokestatic 145	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$3	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/internal/oslc/core/OslcServiceProvider;
      //   171: aload_3
      //   172: invokeinterface 157 4 0
      //   177: astore 6
      //   179: aload_2
      //   180: new 79	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
      //   183: dup
      //   184: aload_0
      //   185: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
      //   188: aload 6
      //   190: invokespecial 149	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:<init>	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;Ljava/lang/Object;)V
      //   193: aload_3
      //   194: invokeinterface 158 3 0
      //   199: goto +42 -> 241
      //   202: astore 4
      //   204: new 72	org/eclipse/core/runtime/Status
      //   207: dup
      //   208: iconst_4
      //   209: ldc 4
      //   211: ldc 2
      //   213: aload 4
      //   215: invokespecial 139	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
      //   218: invokestatic 140	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
      //   221: aload_3
      //   222: invokeinterface 153 1 0
      //   227: goto +20 -> 247
      //   230: astore 10
      //   232: aload_3
      //   233: invokeinterface 153 1 0
      //   238: aload 10
      //   240: athrow
      //   241: aload_3
      //   242: invokeinterface 153 1 0
      //   247: return
      // Line number table:
      //   Java source line #105	-> byte code offset #0
      //   Java source line #106	-> byte code offset #9
      //   Java source line #107	-> byte code offset #18
      //   Java source line #108	-> byte code offset #24
      //   Java source line #109	-> byte code offset #31
      //   Java source line #110	-> byte code offset #39
      //   Java source line #111	-> byte code offset #46
      //   Java source line #112	-> byte code offset #60
      //   Java source line #111	-> byte code offset #66
      //   Java source line #113	-> byte code offset #73
      //   Java source line #114	-> byte code offset #97
      //   Java source line #113	-> byte code offset #117
      //   Java source line #116	-> byte code offset #130
      //   Java source line #117	-> byte code offset #138
      //   Java source line #118	-> byte code offset #150
      //   Java source line #119	-> byte code offset #164
      //   Java source line #118	-> byte code offset #172
      //   Java source line #120	-> byte code offset #179
      //   Java source line #126	-> byte code offset #202
      //   Java source line #127	-> byte code offset #204
      //   Java source line #128	-> byte code offset #211
      //   Java source line #127	-> byte code offset #215
      //   Java source line #130	-> byte code offset #221
      //   Java source line #129	-> byte code offset #230
      //   Java source line #130	-> byte code offset #232
      //   Java source line #131	-> byte code offset #238
      //   Java source line #130	-> byte code offset #241
      //   Java source line #133	-> byte code offset #247
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	248	0	this	ServiceProviderCatalogWrapper
      //   0	248	1	object	Object
      //   0	248	2	collector	org.eclipse.ui.progress.IElementCollector
      //   0	248	3	monitor	org.eclipse.core.runtime.IProgressMonitor
      //   22	3	4	wrapper	ServiceProviderCatalogWrapper
      //   202	12	4	e	org.eclipse.core.runtime.CoreException
      //   29	114	5	parentElement	Object
      //   44	17	6	remoteFolder	OslcServiceProviderCatalog
      //   177	12	6	serviceDescriptor	OslcServiceDescriptor
      //   71	3	7	providers	List<OslcServiceProvider>
      //   95	12	8	oslcServiceProvider	OslcServiceProvider
      //   80	38	9	localIterator	java.util.Iterator
      //   230	9	10	localObject1	Object
      // Exception table:
      //   from	to	target	type
      //   0	199	202	org/eclipse/core/runtime/CoreException
      //   0	221	230	finally
    }
    
    public ISchedulingRule getRule(Object object)
    {
      return null;
    }
    
    public boolean isContainer()
    {
      return ((element instanceof OslcServiceProviderCatalog)) || ((element instanceof OslcServiceProvider));
    }
    
    public Object[] getChildren(Object o)
    {
      return null;
    }
    
    public ImageDescriptor getImageDescriptor(Object object)
    {
      return null;
    }
    
    public String getLabel(Object o)
    {
      if ((element instanceof OslcServiceProvider)) {
        return ((OslcServiceProvider)element).getName();
      }
      if ((element instanceof OslcServiceDescriptor)) {
        return ((OslcServiceDescriptor)element).getDescription();
      }
      return "";
    }
    
    public Object getParent(Object o)
    {
      return null;
    }
    
    public Object getServiceObject()
    {
      return element;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcServiceDiscoveryProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.oslc.core.IOslcConnector;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.Validator;

class OslcRepositorySettingsPage$OslcValidator
  extends AbstractRepositorySettingsPage.Validator
{
  final TaskRepository repository;
  private List<OslcServiceProvider> providers = new ArrayList();
  private final String baseUrl;
  
  public TaskRepository getRepository()
  {
    return repository;
  }
  
  public OslcRepositorySettingsPage$OslcValidator(OslcRepositorySettingsPage paramOslcRepositorySettingsPage, TaskRepository repository, String baseUrl)
  {
    super(paramOslcRepositorySettingsPage);
    this.repository = repository;
    this.baseUrl = baseUrl;
  }
  
  private String getBaseUrl()
  {
    return baseUrl;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    try
    {
      new URL(getBaseUrl());
      
      List<OslcServiceProvider> serviceProviders = ((IOslcConnector)OslcRepositorySettingsPage.access$0(this$0)).getAvailableServices(
        repository, getBaseUrl(), monitor);
      setProviders(serviceProviders);
    }
    catch (MalformedURLException localMalformedURLException)
    {
      throw new CoreException(new Status(4, "org.eclipse.mylyn.oslc.core", 0, 
        OslcRepositorySettingsPage.access$1(), null));
    }
    catch (CoreException e)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.oslc.core", 
        "Error occurred during service discovery", e));
      throw e;
    }
  }
  
  private void setProviders(List<OslcServiceProvider> providers)
  {
    this.providers = providers;
  }
  
  public List<OslcServiceProvider> getProviders()
  {
    return providers;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcRepositorySettingsPage.OslcValidator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.oslc.core.IOslcConnector;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage.Validator;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;

public abstract class OslcRepositorySettingsPage
  extends AbstractRepositorySettingsPage
{
  private OslcServiceDescriptor descriptor;
  protected Text baseText;
  
  public OslcRepositorySettingsPage(String name, String desc, TaskRepository taskRepository)
  {
    super(name, desc, taskRepository);
    setNeedsAnonymousLogin(false);
    setNeedsEncoding(false);
    setNeedsTimeZone(false);
    setNeedsHttpAuth(false);
  }
  
  public OslcServiceDescriptor getProvider()
  {
    return descriptor;
  }
  
  public void setServiceDescriptor(OslcServiceDescriptor descriptor)
  {
    this.descriptor = descriptor;
  }
  
  protected String getBaseUrl()
  {
    return baseText.getText();
  }
  
  protected void createSettingControls(Composite parent)
  {
    Label baseUrlLabel = new Label(parent, 0);
    baseUrlLabel.setText("Base URL:");
    baseText = new Text(parent, 2048);
    if (repository != null)
    {
      String base = repository.getProperty("oslc.baseurl");
      if (base != null) {
        baseText.setText(base);
      }
    }
    baseText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        serverUrlCombo.setText(baseText.getText());
        if (getWizard() != null) {
          getWizard().getContainer().updateButtons();
        }
      }
    });
    GridDataFactory.fillDefaults().hint(300, -1).span(2, 1).grab(true, false).applyTo(baseText);
    
    super.createSettingControls(parent);
    if (serverUrlCombo.getText().length() == 0) {
      serverUrlCombo.setText(Messages.OslcRepositorySettingsPage_Enter_Base_Url_Above);
    }
    serverUrlCombo.setEnabled(false);
  }
  
  public abstract String getConnectorKind();
  
  protected AbstractRepositorySettingsPage.Validator getValidator(TaskRepository repository)
  {
    return new OslcValidator(createTaskRepository(), baseText.getText());
  }
  
  protected boolean isValidUrl(String url)
  {
    if ((url.startsWith("https://")) || (url.startsWith("http://"))) {
      try
      {
        new URL(url);
        return true;
      }
      catch (MalformedURLException localMalformedURLException) {}
    }
    return false;
  }
  
  public void applyTo(TaskRepository repository)
  {
    repository.setProperty("oslc.baseurl", baseText.getText());
    super.applyTo(repository);
  }
  
  protected void applyValidatorResult(AbstractRepositorySettingsPage.Validator validator)
  {
    OslcValidator cqValidator = (OslcValidator)validator;
    if (!cqValidator.getProviders().isEmpty())
    {
      if (repository == null) {
        repository = createTaskRepository();
      }
      OslcServiceDiscoveryWizard oslcWizard = new OslcServiceDiscoveryWizard((IOslcConnector)connector, 
        cqValidator.getRepository(), cqValidator.getProviders());
      OslcServiceDiscoveryWizardDialog dialog = new OslcServiceDiscoveryWizardDialog(getShell(), oslcWizard);
      dialog.setBlockOnOpen(true);
      dialog.create();
      int result = dialog.open();
      if ((result == 0) && (oslcWizard.getSelectedServiceDescriptor() != null))
      {
        setUrl(oslcWizard.getSelectedServiceDescriptor().getAboutUrl());
        setServiceDescriptor(oslcWizard.getSelectedServiceDescriptor());
      }
      else
      {
        cqValidator.setStatus(Status.CANCEL_STATUS);
      }
    }
    super.applyValidatorResult(validator);
  }
  
  protected void createAdditionalControls(Composite parent) {}
  
  private class OslcValidator
    extends AbstractRepositorySettingsPage.Validator
  {
    final TaskRepository repository;
    private List<OslcServiceProvider> providers = new ArrayList();
    private final String baseUrl;
    
    public TaskRepository getRepository()
    {
      return repository;
    }
    
    public OslcValidator(TaskRepository repository, String baseUrl)
    {
      super();
      this.repository = repository;
      this.baseUrl = baseUrl;
    }
    
    private String getBaseUrl()
    {
      return baseUrl;
    }
    
    public void run(IProgressMonitor monitor)
      throws CoreException
    {
      try
      {
        new URL(getBaseUrl());
        
        List<OslcServiceProvider> serviceProviders = ((IOslcConnector)connector).getAvailableServices(
          repository, getBaseUrl(), monitor);
        setProviders(serviceProviders);
      }
      catch (MalformedURLException localMalformedURLException)
      {
        throw new CoreException(new Status(4, "org.eclipse.mylyn.oslc.core", 0, 
          OslcRepositorySettingsPage.INVALID_REPOSITORY_URL, null));
      }
      catch (CoreException e)
      {
        StatusHandler.log(new Status(4, "org.eclipse.mylyn.oslc.core", 
          "Error occurred during service discovery", e));
        throw e;
      }
    }
    
    private void setProviders(List<OslcServiceProvider> providers)
    {
      this.providers = providers;
    }
    
    public List<OslcServiceProvider> getProviders()
    {
      return providers;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcRepositorySettingsPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProviderCatalog;

class OslcServiceDiscoveryWizardPage$1
  implements ISelectionChangedListener
{
  OslcServiceDiscoveryWizardPage$1(OslcServiceDiscoveryWizardPage paramOslcServiceDiscoveryWizardPage) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    TreeSelection selection = (TreeSelection)OslcServiceDiscoveryWizardPage.access$0(this$0).getSelection();
    Object o = selection.getFirstElement();
    if ((o instanceof OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper))
    {
      Object provObj = ((OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper)o).getServiceObject();
      if ((provObj instanceof OslcServiceProviderCatalog)) {
        OslcServiceDiscoveryWizardPage.access$1(this$0, null);
      } else if ((provObj instanceof OslcServiceProvider)) {
        OslcServiceDiscoveryWizardPage.access$1(this$0, null);
      } else if ((provObj instanceof OslcServiceDescriptor)) {
        OslcServiceDiscoveryWizardPage.access$1(this$0, (OslcServiceDescriptor)provObj);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcServiceDiscoveryWizardPage.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import java.util.List;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.internal.oslc.core.IOslcConnector;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProviderCatalog;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

public class OslcServiceDiscoveryWizardPage
  extends WizardPage
{
  private static final String TITLE_SERVICE_DISCOVERY = Messages.OslcServiceDiscoveryWizardPage_Serivce_Discovery;
  private TreeViewer v;
  private OslcServiceDescriptor selectedServiceDescriptor;
  private final TaskRepository repository;
  private final OslcServiceDiscoveryProvider provider;
  private List<OslcServiceProvider> rootProviders;
  
  protected OslcServiceDiscoveryWizardPage(IOslcConnector connector, TaskRepository repository)
  {
    super(TITLE_SERVICE_DISCOVERY, TITLE_SERVICE_DISCOVERY, TasksUiImages.BANNER_REPOSITORY);
    this.repository = repository;
    provider = new OslcServiceDiscoveryProvider(connector, repository, null);
    setMessage(Messages.OslcServiceDiscoveryWizardPage_Browse_Available_Services_Below);
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new GridLayout(1, true));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
    
    v = new TreeViewer(composite, 268437504);
    v.setUseHashlookup(true);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(v.getTree());
    
    v.setLabelProvider(new OslcServiceLabelProvider());
    v.setContentProvider(provider);
    v.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        TreeSelection selection = (TreeSelection)v.getSelection();
        Object o = selection.getFirstElement();
        if ((o instanceof OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper))
        {
          Object provObj = ((OslcServiceDiscoveryProvider.ServiceProviderCatalogWrapper)o).getServiceObject();
          if ((provObj instanceof OslcServiceProviderCatalog)) {
            OslcServiceDiscoveryWizardPage.this.setSelectedServiceDescriptor(null);
          } else if ((provObj instanceof OslcServiceProvider)) {
            OslcServiceDiscoveryWizardPage.this.setSelectedServiceDescriptor(null);
          } else if ((provObj instanceof OslcServiceDescriptor)) {
            OslcServiceDiscoveryWizardPage.this.setSelectedServiceDescriptor((OslcServiceDescriptor)provObj);
          }
        }
      }
    });
    if ((rootProviders != null) && (!rootProviders.isEmpty())) {
      v.setInput(rootProviders);
    } else {
      v.setInput(new OslcServiceProviderCatalog(repository.getRepositoryLabel(), repository.getUrl()));
    }
    setControl(composite);
  }
  
  private void setSelectedServiceDescriptor(OslcServiceDescriptor selectedServiceDescriptor)
  {
    this.selectedServiceDescriptor = selectedServiceDescriptor;
    setPageComplete(selectedServiceDescriptor != null);
  }
  
  public OslcServiceDescriptor getSelectedServiceProvider()
  {
    return selectedServiceDescriptor;
  }
  
  public void setRootProviders(List<OslcServiceProvider> providers)
  {
    rootProviders = providers;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcServiceDiscoveryWizardPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Text;

class OslcRepositorySettingsPage$1
  implements ModifyListener
{
  OslcRepositorySettingsPage$1(OslcRepositorySettingsPage paramOslcRepositorySettingsPage) {}
  
  public void modifyText(ModifyEvent e)
  {
    OslcRepositorySettingsPage.access$2(this$0).setText(this$0.baseText.getText());
    if (this$0.getWizard() != null) {
      this$0.getWizard().getContainer().updateButtons();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.OslcRepositorySettingsPage.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.oslc.ui.messages";
  public static String OslcRepositorySettingsPage_Enter_Base_Url_Above;
  public static String OslcServiceDiscoveryWizardPage_Browse_Available_Services_Below;
  public static String OslcServiceDiscoveryWizardPage_Serivce_Discovery;
  public static String OslcServiceLabelProvider_Loading;
  
  static
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.oslc.ui.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.oslc.ui.Messages
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.oslc.ui;

import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProviderCatalog;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;

public class OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
  implements IDeferredWorkbenchAdapter
{
  private final Object element;
  
  public OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper(OslcServiceDiscoveryProvider paramOslcServiceDiscoveryProvider, Object catalog)
  {
    element = catalog;
  }
  
  /* Error */
  public void fetchDeferredChildren(Object object, org.eclipse.ui.progress.IElementCollector collector, org.eclipse.core.runtime.IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_3
    //   1: invokeinterface 154 1 0
    //   6: ifne +235 -> 241
    //   9: aload_3
    //   10: ldc 3
    //   12: iconst_m1
    //   13: invokeinterface 155 3 0
    //   18: aload_1
    //   19: checkcast 79	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
    //   22: astore 4
    //   24: aload 4
    //   26: invokevirtual 148	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:getServiceObject	()Ljava/lang/Object;
    //   29: astore 5
    //   31: aload 5
    //   33: instanceof 77
    //   36: ifeq +94 -> 130
    //   39: aload 5
    //   41: checkcast 77	org/eclipse/mylyn/internal/oslc/core/OslcServiceProviderCatalog
    //   44: astore 6
    //   46: aload_0
    //   47: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   50: invokestatic 144	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$0	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/internal/oslc/core/IOslcConnector;
    //   53: aload_0
    //   54: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   57: invokestatic 147	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$1	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/tasks/core/TaskRepository;
    //   60: aload 6
    //   62: invokevirtual 143	org/eclipse/mylyn/internal/oslc/core/OslcServiceProviderCatalog:getUrl	()Ljava/lang/String;
    //   65: aload_3
    //   66: invokeinterface 156 4 0
    //   71: astore 7
    //   73: aload 7
    //   75: invokeinterface 152 1 0
    //   80: astore 9
    //   82: goto +35 -> 117
    //   85: aload 9
    //   87: invokeinterface 151 1 0
    //   92: checkcast 76	org/eclipse/mylyn/internal/oslc/core/OslcServiceProvider
    //   95: astore 8
    //   97: aload_2
    //   98: new 79	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
    //   101: dup
    //   102: aload_0
    //   103: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   106: aload 8
    //   108: invokespecial 149	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:<init>	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;Ljava/lang/Object;)V
    //   111: aload_3
    //   112: invokeinterface 158 3 0
    //   117: aload 9
    //   119: invokeinterface 150 1 0
    //   124: ifne -39 -> 85
    //   127: goto +114 -> 241
    //   130: aload 5
    //   132: instanceof 76
    //   135: ifeq +106 -> 241
    //   138: aload_0
    //   139: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   142: aload 5
    //   144: checkcast 76	org/eclipse/mylyn/internal/oslc/core/OslcServiceProvider
    //   147: invokestatic 146	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$2	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;Lorg/eclipse/mylyn/internal/oslc/core/OslcServiceProvider;)V
    //   150: aload_0
    //   151: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   154: invokestatic 144	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$0	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/internal/oslc/core/IOslcConnector;
    //   157: aload_0
    //   158: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   161: invokestatic 147	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$1	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/tasks/core/TaskRepository;
    //   164: aload_0
    //   165: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   168: invokestatic 145	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider:access$3	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;)Lorg/eclipse/mylyn/internal/oslc/core/OslcServiceProvider;
    //   171: aload_3
    //   172: invokeinterface 157 4 0
    //   177: astore 6
    //   179: aload_2
    //   180: new 79	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper
    //   183: dup
    //   184: aload_0
    //   185: getfield 137	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:this$0	Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;
    //   188: aload 6
    //   190: invokespecial 149	org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider$ServiceProviderCatalogWrapper:<init>	(Lorg/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider;Ljava/lang/Object;)V
    //   193: aload_3
    //   194: invokeinterface 158 3 0
    //   199: goto +42 -> 241
    //   202: astore 4
    //   204: new 72	org/eclipse/core/runtime/Status
    //   207: dup
    //   208: iconst_4
    //   209: ldc 4
    //   211: ldc 2
    //   213: aload 4
    //   215: invokespecial 139	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   218: invokestatic 140	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   221: aload_3
    //   222: invokeinterface 153 1 0
    //   227: goto +20 -> 247
    //   230: astore 10
    //   232: aload
1 2

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-2017. Infinite Loop Ltd