org.eclipse.mylyn.builds.ui_0.9.1.v20120425-0100

16:46:20.882 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.builds.ui_0.9.1.v20120425-0100.jar
package org.eclipse.mylyn.builds.ui.spi;

import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.mylyn.builds.core.IBuildPlan;

class BuildServerPart$7
  extends LabelProvider
{
  BuildServerPart$7(BuildServerPart paramBuildServerPart) {}
  
  public String getText(Object element)
  {
    return ((IBuildPlan)element).getName();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.7
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ICheckStateProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.mylyn.builds.core.IBuildPlan;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.builds.core.IBuildServerConfiguration;
import org.eclipse.mylyn.builds.core.spi.BuildServerConfiguration;
import org.eclipse.mylyn.builds.internal.core.BuildPlan;
import org.eclipse.mylyn.builds.internal.core.BuildServer;
import org.eclipse.mylyn.builds.internal.core.operations.RefreshConfigurationOperation;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
import org.eclipse.mylyn.commons.core.operations.IOperationMonitor.OperationFlag;
import org.eclipse.mylyn.commons.core.operations.OperationUtil;
import org.eclipse.mylyn.commons.repositories.core.RepositoryValidator;
import org.eclipse.mylyn.commons.repositories.ui.RepositoryLocationPart;
import org.eclipse.mylyn.commons.workbench.SubstringPatternFilter;
import org.eclipse.mylyn.internal.builds.ui.BuildServerValidator;
import org.eclipse.mylyn.internal.builds.ui.BuildsUiInternal;
import org.eclipse.osgi.util.NLS;
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.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;

public class BuildServerPart
  extends RepositoryLocationPart
{
  private final IBuildServer model;
  private CheckboxTreeViewer planViewer;
  private List<IBuildPlan> selectedPlans;
  
  private class CheckboxFilteredTree
    extends FilteredTree
  {
    public CheckboxFilteredTree(Composite parent, int treeStyle, PatternFilter filter)
    {
      super(treeStyle, filter, true);
    }
    
    protected TreeViewer doCreateTreeViewer(Composite parent, int style)
    {
      return new CheckboxTreeViewer(parent, style);
    }
    
    public CheckboxTreeViewer getCheckboxTreeViewer()
    {
      return getViewer();
    }
    
    public CheckboxTreeViewer getViewer()
    {
      return (CheckboxTreeViewer)super.getViewer();
    }
  }
  
  private class Validator
    extends BuildServerValidator
  {
    private IBuildServerConfiguration configuration;
    
    public Validator(IBuildServer server)
    {
      super();
    }
    
    public IBuildServerConfiguration getConfiguration()
    {
      return configuration;
    }
    
    public IStatus run(IProgressMonitor monitor)
    {
      IOperationMonitor progress = OperationUtil.convert(monitor, "Validating repository", 3);
      progress.addFlag(IOperationMonitor.OperationFlag.BACKGROUND);
      try
      {
        IBuildServer server = getServer();
        IStatus result = ((BuildServer)server).validate(progress.newChild(1));
        if (result.isOK())
        {
          RefreshConfigurationOperation op = new RefreshConfigurationOperation(
            Collections.singletonList(server));
          op.doRefresh((BuildServer)server, progress.newChild(2));
          result = op.getStatus();
          configuration = server.getConfiguration();
        }
        return result;
      }
      catch (CoreException e)
      {
        return new Status(4, "org.eclipse.mylyn.builds.ui", NLS.bind("Server validation failed: {0}", 
          e.getMessage()), e);
      }
    }
  }
  
  public BuildServerPart(IBuildServer model)
  {
    super(model.getLocation());
    this.model = model;
    selectedPlans = Collections.emptyList();
    setNeedsProxy(true);
    setNeedsHttpAuth(true);
    setNeedsCertificateAuth(true);
  }
  
  protected void applyValidatorResult(RepositoryValidator validator)
  {
    super.applyValidatorResult(validator);
    if (!validator.getResult().isOK()) {
      StatusHandler.log(validator.getResult());
    }
    IBuildServerConfiguration configuration = ((Validator)validator).getConfiguration();
    if (configuration != null) {
      setInput(configuration, getSelectedPlans());
    }
  }
  
  protected void setInput(IBuildServerConfiguration configuration, Collection<IBuildPlan> selectedPlans)
  {
    Set<String> selectedIds = BuildsUiInternal.toSetOfIds(selectedPlans);
    for (IBuildPlan plan : configuration.getPlans()) {
      ((BuildPlan)plan).setSelected(selectedIds.contains(plan.getId()));
    }
    planViewer.setInput(configuration);
    planViewer.expandAll();
  }
  
  public boolean canValidate()
  {
    return true;
  }
  
  private void createButtons(Composite section)
  {
    Button refreshButton = new Button(section, 8);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(refreshButton);
    refreshButton.setText("&Refresh");
    refreshButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        validate();
      }
    });
    Button selectAllButton = new Button(section, 8);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(selectAllButton);
    selectAllButton.setText("&Select All");
    selectAllButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        TreeItem[] items = planViewer.getTree().getItems();
        TreeItem[] arrayOfTreeItem1;
        int j = (arrayOfTreeItem1 = items).length;
        for (int i = 0; i < j; i++)
        {
          TreeItem item = arrayOfTreeItem1[i];
          if ((item.getData() instanceof BuildPlan)) {
            ((BuildPlan)item.getData()).setSelected(true);
          }
        }
        planViewer.refresh();
      }
    });
    Button deselectAllButton = new Button(section, 8);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(deselectAllButton);
    deselectAllButton.setText("&Deselect All");
    deselectAllButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent event)
      {
        TreeItem[] items = planViewer.getTree().getItems();
        TreeItem[] arrayOfTreeItem1;
        int j = (arrayOfTreeItem1 = items).length;
        for (int i = 0; i < j; i++)
        {
          TreeItem item = arrayOfTreeItem1[i];
          if ((item.getData() instanceof BuildPlan)) {
            ((BuildPlan)item.getData()).setSelected(false);
          }
        }
        planViewer.refresh();
      }
    });
    Button dummyButton = new Button(section, 32);
    dummyButton.setVisible(false);
    dummyButton.setText("Save Password");
  }
  
  public Control createContents(Composite parent)
  {
    Control control = super.createContents(parent);
    try
    {
      IBuildServerConfiguration configuration = getModel().getConfiguration();
      setInput(configuration, selectedPlans);
    }
    catch (CoreException localCoreException) {}
    return control;
  }
  
  protected Control createAdditionalContents(final Composite parent)
  {
    final ExpandableComposite section = new ExpandableComposite(parent, 0, 114);
    
    clientVerticalSpacing = 0;
    section.setBackground(parent.getBackground());
    section.setFont(JFaceResources.getFontRegistry().getBold("org.eclipse.jface.dialogfont"));
    section.addExpansionListener(new ExpansionAdapter()
    {
      public void expansionStateChanged(ExpansionEvent e)
      {
        if ((section.getLayoutData() instanceof GridData)) {
          sectiongetLayoutDatagrabExcessVerticalSpace = e.getState();
        }
        parent.layout(true);
      }
    });
    section.setText("Build Plans");
    
    Composite composite = new Composite(section, 0);
    section.setClient(composite);
    GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 5).applyTo(composite);
    
    CheckboxFilteredTree filteredTree = new CheckboxFilteredTree(composite, 67584, 
      new SubstringPatternFilter());
    GridDataFactory.fillDefaults().grab(true, true).hint(-1, 200).applyTo(filteredTree);
    planViewer = filteredTree.getCheckboxTreeViewer();
    planViewer.addCheckStateListener(new ICheckStateListener()
    {
      public void checkStateChanged(CheckStateChangedEvent event)
      {
        BuildPlan plan = (BuildPlan)event.getElement();
        plan.setSelected(event.getChecked());
      }
    });
    planViewer.setCheckStateProvider(new ICheckStateProvider()
    {
      public boolean isChecked(Object element)
      {
        return ((IBuildPlan)element).isSelected();
      }
      
      public boolean isGrayed(Object element)
      {
        for (IBuildPlan child : ((IBuildPlan)element).getChildren()) {
          if (!child.isSelected()) {
            return true;
          }
        }
        return false;
      }
    });
    planViewer.setLabelProvider(new LabelProvider()
    {
      public String getText(Object element)
      {
        return ((IBuildPlan)element).getName();
      }
    });
    planViewer.setContentProvider(new ITreeContentProvider()
    {
      private BuildServerConfiguration configuration;
      private final Object[] EMPTY_ARRAY = new Object[0];
      
      public void dispose() {}
      
      public Object[] getChildren(Object parentElement)
      {
        return EMPTY_ARRAY;
      }
      
      public Object[] getElements(Object inputElement)
      {
        return configuration.getPlans().toArray();
      }
      
      public Object getParent(Object element)
      {
        return null;
      }
      
      public boolean hasChildren(Object element)
      {
        return false;
      }
      
      public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
      {
        configuration = ((BuildServerConfiguration)newInput);
      }
    });
    planViewer.setSorter(new ViewerSorter());
    
    Composite buttonComposite = new Composite(composite, 0);
    GridDataFactory.fillDefaults().align(1, 128).applyTo(buttonComposite);
    GridLayoutFactory.fillDefaults()
      .numColumns(1)
      .margins(0, 0)
      .extendedMargins(0, 0, 0, 0)
      .applyTo(buttonComposite);
    createButtons(buttonComposite);
    
    return section;
  }
  
  public final IBuildServer getModel()
  {
    return model;
  }
  
  public List<IBuildPlan> getSelectedPlans()
  {
    if ((planViewer.getInput() instanceof BuildServerConfiguration))
    {
      BuildServerConfiguration configuration = (BuildServerConfiguration)planViewer.getInput();
      List<IBuildPlan> selectedPlans = new ArrayList();
      for (IBuildPlan plan : configuration.getPlans()) {
        if (plan.isSelected()) {
          selectedPlans.add(plan);
        }
      }
      return selectedPlans;
    }
    return Collections.emptyList();
  }
  
  protected RepositoryValidator getValidator()
  {
    return new Validator(getModel());
  }
  
  public void initSelectedPlans(List<IBuildPlan> selectedPlans)
  {
    Assert.isNotNull(selectedPlans);
    this.selectedPlans = selectedPlans;
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class BuildServerPart$1
  extends SelectionAdapter
{
  BuildServerPart$1(BuildServerPart paramBuildServerPart) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    this$0.validate();
  }
}

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

import java.util.List;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.builds.core.spi.BuildServerConfiguration;

class BuildServerPart$8
  implements ITreeContentProvider
{
  private BuildServerConfiguration configuration;
  private final Object[] EMPTY_ARRAY = new Object[0];
  
  BuildServerPart$8(BuildServerPart paramBuildServerPart) {}
  
  public void dispose() {}
  
  public Object[] getChildren(Object parentElement)
  {
    return EMPTY_ARRAY;
  }
  
  public Object[] getElements(Object inputElement)
  {
    return configuration.getPlans().toArray();
  }
  
  public Object getParent(Object element)
  {
    return null;
  }
  
  public boolean hasChildren(Object element)
  {
    return false;
  }
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
  {
    configuration = ((BuildServerConfiguration)newInput);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.8
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;

class BuildServerWizardPage$1
  implements IAdaptable
{
  BuildServerWizardPage$1(BuildServerWizardPage paramBuildServerWizardPage) {}
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == RepositoryLocation.class) {
      return this$0.getModel().getLocation();
    }
    return null;
  }
}

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

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.builds.core.spi.BuildConnector;
import org.eclipse.ui.plugin.AbstractUIPlugin;

public abstract class BuildConnectorUi
{
  private BuildConnector core;
  private IConfigurationElement element;
  private ImageDescriptor descriptor;
  
  public final void init(BuildConnector core, IConfigurationElement element)
  {
    Assert.isNotNull(core);
    if (this.core != null) {
      throw new IllegalStateException("Already initialized");
    }
    this.core = core;
    this.element = element;
  }
  
  public final BuildConnector getCore()
  {
    return core;
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    if ((descriptor == null) && 
      (element != null))
    {
      String iconPath = element.getAttribute("icon");
      if (iconPath != null) {
        descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(element.getContributor().getName(), 
          iconPath);
      }
    }
    return descriptor;
  }
}

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

import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.mylyn.builds.core.IBuildPlan;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
import org.eclipse.mylyn.commons.repositories.ui.RepositoryWizardPage;

public class BuildServerWizardPage
  extends RepositoryWizardPage
{
  private IBuildServer model;
  private List<IBuildPlan> selectedPlans;
  
  public BuildServerWizardPage(String pageName)
  {
    super(pageName);
    setTitle("Build Server Properties");
    setElement(new IAdaptable()
    {
      public Object getAdapter(Class adapter)
      {
        if (adapter == RepositoryLocation.class) {
          return getModel().getLocation();
        }
        return null;
      }
    });
  }
  
  protected BuildServerPart doCreateRepositoryPart()
  {
    BuildServerPart buildServerPart = new BuildServerPart(getModel());
    buildServerPart.initSelectedPlans(selectedPlans);
    return buildServerPart;
  }
  
  public IBuildServer getModel()
  {
    return model;
  }
  
  public BuildServerPart getPart()
  {
    return (BuildServerPart)super.getPart();
  }
  
  public List<IBuildPlan> getSelectedPlans()
  {
    return getPart().getSelectedPlans();
  }
  
  public void init(IBuildServer model, List<IBuildPlan> selectedPlans)
  {
    this.model = model;
    this.selectedPlans = selectedPlans;
  }
}

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

import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.mylyn.builds.internal.core.BuildPlan;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

class BuildServerPart$2
  extends SelectionAdapter
{
  BuildServerPart$2(BuildServerPart paramBuildServerPart) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    TreeItem[] items = BuildServerPart.access$0(this$0).getTree().getItems();
    TreeItem[] arrayOfTreeItem1;
    int j = (arrayOfTreeItem1 = items).length;
    for (int i = 0; i < j; i++)
    {
      TreeItem item = arrayOfTreeItem1[i];
      if ((item.getData() instanceof BuildPlan)) {
        ((BuildPlan)item.getData()).setSelected(true);
      }
    }
    BuildServerPart.access$0(this$0).refresh();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import java.util.Collections;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.builds.core.IBuildServerConfiguration;
import org.eclipse.mylyn.builds.internal.core.BuildServer;
import org.eclipse.mylyn.builds.internal.core.operations.RefreshConfigurationOperation;
import org.eclipse.mylyn.commons.core.operations.IOperationMonitor;
import org.eclipse.mylyn.commons.core.operations.IOperationMonitor.OperationFlag;
import org.eclipse.mylyn.commons.core.operations.OperationUtil;
import org.eclipse.mylyn.internal.builds.ui.BuildServerValidator;
import org.eclipse.osgi.util.NLS;

class BuildServerPart$Validator
  extends BuildServerValidator
{
  private IBuildServerConfiguration configuration;
  
  public BuildServerPart$Validator(BuildServerPart paramBuildServerPart, IBuildServer server)
  {
    super(server);
  }
  
  public IBuildServerConfiguration getConfiguration()
  {
    return configuration;
  }
  
  public IStatus run(IProgressMonitor monitor)
  {
    IOperationMonitor progress = OperationUtil.convert(monitor, "Validating repository", 3);
    progress.addFlag(IOperationMonitor.OperationFlag.BACKGROUND);
    try
    {
      IBuildServer server = getServer();
      IStatus result = ((BuildServer)server).validate(progress.newChild(1));
      if (result.isOK())
      {
        RefreshConfigurationOperation op = new RefreshConfigurationOperation(
          Collections.singletonList(server));
        op.doRefresh((BuildServer)server, progress.newChild(2));
        result = op.getStatus();
        configuration = server.getConfiguration();
      }
      return result;
    }
    catch (CoreException e)
    {
      return new Status(4, "org.eclipse.mylyn.builds.ui", NLS.bind("Server validation failed: {0}", 
        e.getMessage()), e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.Validator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.mylyn.builds.internal.core.BuildPlan;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

class BuildServerPart$3
  extends SelectionAdapter
{
  BuildServerPart$3(BuildServerPart paramBuildServerPart) {}
  
  public void widgetSelected(SelectionEvent event)
  {
    TreeItem[] items = BuildServerPart.access$0(this$0).getTree().getItems();
    TreeItem[] arrayOfTreeItem1;
    int j = (arrayOfTreeItem1 = items).length;
    for (int i = 0; i < j; i++)
    {
      TreeItem item = arrayOfTreeItem1[i];
      if ((item.getData() instanceof BuildPlan)) {
        ((BuildPlan)item.getData()).setSelected(false);
      }
    }
    BuildServerPart.access$0(this$0).refresh();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.builds.core.IBuildModel;
import org.eclipse.mylyn.builds.core.IBuildPlan;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.builds.internal.core.BuildModel;
import org.eclipse.mylyn.builds.internal.core.BuildPlan;
import org.eclipse.mylyn.builds.internal.core.BuildServer;
import org.eclipse.mylyn.builds.internal.core.operations.RefreshOperation;
import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
import org.eclipse.mylyn.internal.builds.ui.BuildsUiInternal;
import org.eclipse.mylyn.internal.builds.ui.OperationFactory;
import org.eclipse.mylyn.internal.builds.ui.view.BuildsView;
import org.eclipse.mylyn.internal.commons.repositories.core.InMemoryCredentialsStore;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.internal.WorkbenchImages;

public class BuildServerWizard
  extends Wizard
  implements INewWizard
{
  private IBuildServer model;
  private IBuildServer original;
  
  public BuildServerWizard(IBuildServer server)
  {
    original = server;
    setNeedsProgressMonitor(true);
    if (isNew())
    {
      setWindowTitle("New Build Server");
      setDefaultPageImageDescriptor(WorkbenchImages.getImageDescriptor("IMG_WIZBAN_NEW_WIZ"));
    }
    else
    {
      setWindowTitle("Build Server Properties");
      setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY_SETTINGS);
    }
  }
  
  public void setBuildServer(IBuildServer server)
  {
    original = server;
    setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY_SETTINGS);
  }
  
  public void addPages()
  {
    BuildServerWizardPage page = new BuildServerWizardPage("newBuildServer");
    page.init(getModel(), getSelectedPlans());
    initPage(page);
    addPage(page);
  }
  
  protected void initPage(BuildServerWizardPage page) {}
  
  private List<IBuildPlan> getSelectedPlans()
  {
    return BuildsUiInternal.getModel().getPlans(original);
  }
  
  public IBuildServer getModel()
  {
    if (model == null)
    {
      model = ((BuildServer)original).createWorkingCopy();
      RepositoryLocation workingCopy = new RepositoryLocation(original.getLocation());
      
      workingCopy.setCredentialsStore(new InMemoryCredentialsStore(workingCopy.getCredentialsStore()));
      ((BuildServer)model).setLocation(workingCopy);
    }
    return model;
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection) {}
  
  public boolean performFinish()
  {
    ((BuildServer)getModel()).applyToOriginal();
    getModel().getLocation().setIdPreservingCredentialsStore(getModel().getLocation().getUrl());
    original.getLocation().apply(getModel().getLocation());
    if (isNew()) {
      BuildsUiInternal.getModel().getServers().add(original);
    }
    updateSubscription(BuildsUiInternal.getModel());
    BuildsView.openInActivePerspective();
    
    BuildsUiInternal.getFactory().getRefreshOperation(original).execute();
    
    return true;
  }
  
  private void updateSubscription(IBuildModel model)
  {
    List<IBuildPlan> oldPlans = ((BuildModel)model).getPlans(original);
    List<IBuildPlan> selectedPlans = ((BuildServerWizardPage)getPages()[0]).getSelectedPlans();
    
    Set<String> oldPlanIds = BuildsUiInternal.toSetOfIds(oldPlans);
    HashSet<String> toRemovePlanIds = new HashSet(oldPlanIds);
    Set<String> toAddPlanIds = BuildsUiInternal.toSetOfIds(selectedPlans);
    toRemovePlanIds.removeAll(toAddPlanIds);
    toAddPlanIds.removeAll(oldPlanIds);
    if (toAddPlanIds.size() > 0)
    {
      List<IBuildPlan> addPlans = new ArrayList(toAddPlanIds.size());
      for (IBuildPlan plan : selectedPlans) {
        if (toAddPlanIds.contains(plan.getId()))
        {
          ((BuildPlan)plan).setServer(original);
          addPlans.add(plan);
        }
      }
      model.getPlans().addAll(addPlans);
    }
    if (toRemovePlanIds.size() > 0)
    {
      List<IBuildPlan> removePlans = new ArrayList(toRemovePlanIds.size());
      for (IBuildPlan plan : oldPlans) {
        if (toRemovePlanIds.contains(plan.getId())) {
          removePlans.add(plan);
        }
      }
      model.getPlans().removeAll(removePlans);
    }
  }
  
  private boolean isNew()
  {
    return ((BuildServer)original).eContainer() != BuildsUiInternal.getModel();
  }
}

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

import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;

class BuildServerPart$CheckboxFilteredTree
  extends FilteredTree
{
  public BuildServerPart$CheckboxFilteredTree(BuildServerPart paramBuildServerPart, Composite parent, int treeStyle, PatternFilter filter)
  {
    super(parent, treeStyle, filter, true);
  }
  
  protected TreeViewer doCreateTreeViewer(Composite parent, int style)
  {
    return new CheckboxTreeViewer(parent, style);
  }
  
  public CheckboxTreeViewer getCheckboxTreeViewer()
  {
    return getViewer();
  }
  
  public CheckboxTreeViewer getViewer()
  {
    return (CheckboxTreeViewer)super.getViewer();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.CheckboxFilteredTree
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;

class BuildServerPart$4
  extends ExpansionAdapter
{
  BuildServerPart$4(BuildServerPart paramBuildServerPart, ExpandableComposite paramExpandableComposite, Composite paramComposite) {}
  
  public void expansionStateChanged(ExpansionEvent e)
  {
    if ((val$section.getLayoutData() instanceof GridData)) {
      val$section.getLayoutData()).grabExcessVerticalSpace = e.getState();
    }
    val$parent.layout(true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui.spi;

import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.mylyn.builds.internal.core.BuildPlan;

class BuildServerPart$5
  implements ICheckStateListener
{
  BuildServerPart$5(BuildServerPart paramBuildServerPart) {}
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    BuildPlan plan = (BuildPlan)event.getElement();
    plan.setSelected(event.getChecked());
  }
}

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

import org.eclipse.jface.viewers.ICheckStateProvider;
import org.eclipse.mylyn.builds.core.IBuildPlan;

class BuildServerPart$6
  implements ICheckStateProvider
{
  BuildServerPart$6(BuildServerPart paramBuildServerPart) {}
  
  public boolean isChecked(Object element)
  {
    return ((IBuildPlan)element).isSelected();
  }
  
  public boolean isGrayed(Object element)
  {
    for (IBuildPlan child : ((IBuildPlan)element).getChildren()) {
      if (!child.isSelected()) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.builds.ui.spi.BuildServerPart.6
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.builds.ui;

public final class BuildsUiConstants
{
  public static final String GROUP_EDIT = "group.edit";
  public static final String GROUP_FILE = "group.file";
  public static final String GROUP_REFRESH = "group.refresh";
  public static final String GROUP_FILTER = "group.filter";
  public static final String GROUP_NAVIGATE = "group.navigate";
  public static final String GROUP_OPEN = "group.open";
  public static final String GROUP_PREFERENCES = "group.preferences";
  public static final String GROUP_PROPERTIES = "group.properties";
  public static final String ID_EDITOR_BUILDS = "org.eclipse.mylyn.builds.ui.editors.Build";
  public static final String ID_VIEW_BUILDS = "org.eclipse.mylyn.builds.navigator.builds";
  public static final String ID_REPOSITORY_CATEGORY_BUILDS = "org.eclipse.mylyn.builds.ui.category.Builds";
}

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

public abstract class BuildsUiStartup
{
  public abstract void lazyStartup();
}

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

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.builds.ui.spi.BuildServerWizard;
import org.eclipse.mylyn.commons.ui.dialogs.ValidatableWizardDialog;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;

public class BuildsUiUtil
{
  public static int openPropertiesDialog(IBuildServer server)
  {
    Wizard wizard = new BuildServerWizard(server);
    ValidatableWizardDialog dialog = new ValidatableWizardDialog(WorkbenchUtil.getShell(), wizard);
    dialog.create();
    return dialog.open();
  }
}

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

import java.util.List;
import org.eclipse.mylyn.builds.core.IBuildModel;
import org.eclipse.mylyn.builds.core.IBuildServer;

class BuildsUi$1
  implements Runnable
{
  BuildsUi$1(IBuildModel paramIBuildModel, List paramList) {}
  
  public void run()
  {
    List<IBuildServer> servers = val$model.getServers();
    for (IBuildServer server : servers) {
      val$locations.add(server.getLocation());
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.mylyn.builds.core.IBuildElement;
import org.eclipse.mylyn.builds.core.IBuildModel;
import org.eclipse.mylyn.builds.core.IBuildServer;
import org.eclipse.mylyn.builds.core.spi.BuildConnector;
import org.eclipse.mylyn.builds.internal.core.BuildServer;
import org.eclipse.mylyn.builds.internal.core.IBuildModelRealm;
import org.eclipse.mylyn.builds.internal.core.operations.IOperationService;
import org.eclipse.mylyn.builds.ui.spi.BuildConnectorUi;
import org.eclipse.mylyn.commons.notifications.core.INotificationService;
import org.eclipse.mylyn.commons.notifications.ui.NotificationsUi;
import org.eclipse.mylyn.commons.repositories.core.RepositoryLocation;
import org.eclipse.mylyn.commons.workbench.EditorHandle;
import org.eclipse.mylyn.internal.builds.ui.BuildConnectorDescriptor;
import org.eclipse.mylyn.internal.builds.ui.BuildsUiInternal;
import org.eclipse.mylyn.internal.builds.ui.commands.OpenHandler;
import org.eclipse.mylyn.internal.builds.ui.notifications.BuildsServiceNotification;
import org.eclipse.mylyn.internal.builds.ui.view.BuildsView;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.statushandlers.StatusManager;

public class BuildsUi
{
  private static HashMap<String, BuildConnectorDescriptor> descriptorByKind;
  
  public static synchronized BuildConnector getConnector(String connectorKind)
  {
    BuildConnectorDescriptor descriptor = (BuildConnectorDescriptor)getConnectorDescriptorByKind().get(connectorKind);
    return descriptor != null ? descriptor.getCoreDelegate() : null;
  }
  
  public static synchronized BuildConnectorUi getConnectorUi(String connectorKind)
  {
    BuildConnectorDescriptor descriptor = (BuildConnectorDescriptor)getConnectorDescriptorByKind().get(connectorKind);
    return descriptor != null ? descriptor.getUiDelegate() : null;
  }
  
  public static synchronized IBuildModel getModel()
  {
    return BuildsUiInternal.getModel();
  }
  
  private static synchronized HashMap<String, BuildConnectorDescriptor> getConnectorDescriptorByKind()
  {
    if (descriptorByKind != null) {
      return descriptorByKind;
    }
    descriptorByKind = new HashMap();
    
    MultiStatus result = new MultiStatus("org.eclipse.mylyn.builds.ui", 0, "Build connectors failed to load.", null);
    
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint connectorsExtensionPoint = registry.getExtensionPoint("org.eclipse.mylyn.builds.ui.connectors");
    IExtension[] extensions = connectorsExtensionPoint.getExtensions();
    IExtension[] arrayOfIExtension1;
    int j = (arrayOfIExtension1 = extensions).length;
    for (int i = 0; i < j; i++)
    {
      IExtension extension = arrayOfIExtension1[i];
      IConfigurationElement[] elements = extension.getConfigurationElements();
      IConfigurationElement[] arrayOfIConfigurationElement1;
      int m = (arrayOfIConfigurationElement1 = elements).length;
      for (int k = 0; k < m; k++)
      {
        IConfigurationElement element = arrayOfIConfigurationElement1[k];
        BuildConnectorDescriptor descriptor = new BuildConnectorDescriptor(element);
        IStatus status = descriptor.validate();
        if (status.isOK()) {
          descriptorByKind.put(descriptor.getConnectorKind(), descriptor);
        } else {
          result.add(status);
        }
      }
    }
    if (!result.isOK()) {
      StatusManager.getManager().handle(result);
    }
    return descriptorByKind;
  }
  
  public static IBuildServer createServer(String connectorKind)
  {
    return BuildsUiInternal.createServer(connectorKind, new RepositoryLocation());
  }
  
  public static BuildConnector getConnector(IBuildServer server)
  {
    return getConnector(((BuildServer)server).getConnectorKind());
  }
  
  public static BuildConnectorUi getConnectorUi(IBuildServer server)
  {
    return getConnectorUi(((BuildServer)server).getConnectorKind());
  }
  
  public static void serverDiscovered(String title, String description)
  {
    BuildsServiceNotification notification = new BuildsServiceNotification(title, description);
    NotificationsUi.getService().notify(Collections.singletonList(notification));
  }
  
  public static void open(IBuildElement element)
  {
    Assert.isNotNull(element);
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null)
    {
      IWorkbenchPage page = window.getActivePage();
      if (page != null)
      {
        List<EditorHandle> handle = OpenHandler.open(page, Collections.singletonList(element));
        if ((((EditorHandle)handle.get(0)).getStatus() != null) && (((EditorHandle)handle.get(0)).getStatus().isOK())) {
          return;
        }
      }
    }
    BuildsView.openInActivePerspective();
  }
  
  public static List<RepositoryLocation> getServerLocations()
  {
    final List<RepositoryLocation> locations = new ArrayList();
    IBuildModel model = getModel();
    BuildsUiInternal.getOperationService().getRealm().syncExec(new Runnable()
    {
      public void run()
      {
        List<IBuildServer> servers = getServers();
        for (IBuildServer server : servers) {
          locations.add(server.getLocation());
        }
      }
    });
    return locations;
  }
}

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

import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.widgets.Display;

class BuildsView$1
  implements IPropertyChangeListener
{
  BuildsView$1(BuildsView paramBuildsView) {}
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if ("refresh.enabled".equals(event.getProperty())) {
      Display.getDefault().asyncExec(new Runnable()
      {
        public void run()
        {
          if (BuildsView.access$0(this$0) != null) {
            BuildsView.access$0(this$0).updateState();
          }
        }
      });
    }
  }
}

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

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.u
1 2 3 4 5 6 7 8 9 10 11

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