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

rs.TaskEditor;

class TaskHyperlink$1
  extends TaskOpenListener
{
  TaskHyperlink$1(TaskHyperlink paramTaskHyperlink) {}
  
  public void taskOpened(TaskOpenEvent event)
  {
    if (TaskHyperlink.access$0(this$0) == null) {
      return;
    }
    if ((event.getEditor() instanceof TaskEditor))
    {
      TaskEditor editor = (TaskEditor)event.getEditor();
      editor.selectReveal(TaskHyperlink.access$0(this$0));
    }
  }
}

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

import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.mylyn.tasks.core.TaskRepository;

public abstract interface ITasksUiFactory
{
  public abstract IContentAssistProcessor createTaskContentAssistProcessor(TaskRepository paramTaskRepository);
  
  public abstract IContentProposalProvider createPersonContentProposalProvider(TaskRepository paramTaskRepository);
  
  public abstract ILabelProvider createPersonContentProposalLabelProvider(TaskRepository paramTaskRepository);
}

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

import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.workbench.EditorHandle;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenEvent;
import org.eclipse.mylyn.internal.tasks.ui.util.TaskOpenListener;

class TasksUiUtil$1
  extends TaskOpenListener
{
  TasksUiUtil$1(EditorHandle paramEditorHandle) {}
  
  public void taskOpened(TaskOpenEvent event)
  {
    val$handle.setPart(event.getEditor());
    val$handle.setItem(event.getTask());
    val$handle.setStatus(Status.OK_STATUS);
  }
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.swt.graphics.Image;

public class LegendElement
{
  private final Image image;
  private final String label;
  
  public static LegendElement createTask(String label, ImageDescriptor overlay)
  {
    return new LegendElement(label, CommonImages.getCompositeTaskImage(TasksUiImages.TASK, overlay, false));
  }
  
  private LegendElement(String label, Image image)
  {
    this.label = label;
    this.image = image;
  }
  
  public void dispose() {}
  
  public Image getImage()
  {
    return image;
  }
  
  public String getLabel()
  {
    return label;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.TaskRepository;

public abstract class AbstractTaskRepositoryLinkProvider
  implements IExecutableExtension
{
  private static final int DEFAULT_ORDER = 1000;
  private String id;
  private String name;
  private int order;
  
  public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
  {
    id = config.getAttribute("id");
    name = config.getAttribute("name");
    try
    {
      order = Integer.parseInt(config.getAttribute("order"));
    }
    catch (NumberFormatException localNumberFormatException)
    {
      order = 1000;
    }
  }
  
  public abstract TaskRepository getTaskRepository(IResource paramIResource, IRepositoryManager paramIRepositoryManager);
  
  public boolean canSetTaskRepository(IResource resource)
  {
    return false;
  }
  
  public boolean setTaskRepository(IResource resource, TaskRepository repository)
  {
    return false;
  }
  
  public String getId()
  {
    return id;
  }
  
  public String getName()
  {
    return name;
  }
  
  public int getOrder()
  {
    return order;
  }
}

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

import org.eclipse.jface.resource.ImageDescriptor;

class TaskElementLabelProvider$CompositeImageDescriptor
{
  ImageDescriptor icon;
  ImageDescriptor overlayKind;
  
  private TaskElementLabelProvider$CompositeImageDescriptor(TaskElementLabelProvider paramTaskElementLabelProvider) {}
}

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

import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
import org.eclipse.ui.contexts.IContextService;

class TaskAttachmentPage$3
  extends RichTextEditor
{
  TaskAttachmentPage$3(TaskAttachmentPage paramTaskAttachmentPage, TaskRepository $anonymous0, int $anonymous1, IContextService $anonymous2, AbstractTaskEditorExtension $anonymous3, ITask $anonymous4)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3, $anonymous4);
  }
  
  protected void valueChanged(String value)
  {
    TaskAttachmentPage.access$4(this$0);
  }
}

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

import org.eclipse.jface.dialogs.IDialogPage;

public abstract interface ITaskSearchPage
  extends IDialogPage
{
  public abstract void setContainer(ITaskSearchPageContainer paramITaskSearchPageContainer);
  
  public abstract boolean performSearch();
}

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

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.mylyn.internal.tasks.core.ITaskList;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.osgi.util.NLS;

public class RepositoryQueryWizard
  extends Wizard
{
  private final TaskRepository repository;
  
  public RepositoryQueryWizard(TaskRepository repository)
  {
    Assert.isNotNull(repository);
    this.repository = repository;
    setNeedsProgressMonitor(true);
    setWindowTitle(Messages.RepositoryQueryWizard_Edit_Repository_Query);
    setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
  }
  
  public boolean canFinish()
  {
    IWizardPage currentPage = getContainer().getCurrentPage();
    if ((currentPage instanceof AbstractRepositoryQueryPage)) {
      return currentPage.isPageComplete();
    }
    return false;
  }
  
  public boolean performFinish()
  {
    IWizardPage currentPage = getContainer().getCurrentPage();
    if (!(currentPage instanceof AbstractRepositoryQueryPage)) {
      throw new AssertionError(NLS.bind(
        "Current wizard page ''{0}'' does not extends AbstractRepositoryQueryPage", currentPage.getClass()));
    }
    AbstractRepositoryQueryPage page = (AbstractRepositoryQueryPage)currentPage;
    IRepositoryQuery query = page.getQuery();
    if (query != null)
    {
      String oldSummary = query.getSummary();
      page.applyTo(query);
      if ((query instanceof RepositoryQuery)) {
        TasksUiPlugin.getTaskList().notifyElementChanged((RepositoryQuery)query);
      }
      if ((oldSummary == null) || (!oldSummary.equals(query.getSummary()))) {
        TasksUiPlugin.getTaskList().notifyElementsChanged(null);
      }
    }
    else
    {
      query = page.createQuery();
      TasksUiInternal.getTaskList().addQuery((RepositoryQuery)query);
    }
    AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
      getTaskRepository().getConnectorKind());
    TasksUiInternal.synchronizeQuery(connector, (RepositoryQuery)query, null, true);
    return true;
  }
  
  public TaskRepository getTaskRepository()
  {
    return repository;
  }
}

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

class AbstractTaskRepositoryPage$1
  implements AbstractTaskRepositoryPageContribution.Listener
{
  AbstractTaskRepositoryPage$1(AbstractTaskRepositoryPage paramAbstractTaskRepositoryPage) {}
  
  public void validationRequired(AbstractTaskRepositoryPageContribution contribution)
  {
    AbstractTaskRepositoryPage.access$0(this$0);
  }
}

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

import org.eclipse.mylyn.commons.workbench.browser.BrowserUtil;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class AbstractRepositorySettingsPage$11
  extends HyperlinkAdapter
{
  AbstractRepositorySettingsPage$11(AbstractRepositorySettingsPage paramAbstractRepositorySettingsPage) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    TaskRepository repository = this$0.createTaskRepository();
    if (repository != null)
    {
      String accountCreationUrl = TasksUiPlugin.getConnectorUi(this$0.connector.getConnectorKind())
        .getAccountCreationUrl(repository);
      if (accountCreationUrl != null) {
        BrowserUtil.openUrl(accountCreationUrl, 128);
      }
    }
  }
}

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

public abstract interface AbstractTaskRepositoryPageContribution$Listener
{
  public abstract void validationRequired(AbstractTaskRepositoryPageContribution paramAbstractTaskRepositoryPageContribution);
}

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

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

class AbstractRepositorySettingsPage$18
  implements SelectionListener
{
  AbstractRepositorySettingsPage$18(AbstractRepositorySettingsPage paramAbstractRepositorySettingsPage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.setHttpAuth(AbstractRepositorySettingsPage.access$6(this$0).getSelection());
  }
  
  public void widgetDefaultSelected(SelectionEvent e) {}
}

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

import org.eclipse.swt.widgets.Composite;

class AbstractRepositorySettingsPage$24
  extends AbstractRepositorySettingsPage.RepositoryStringFieldEditor
{
  AbstractRepositorySettingsPage$24(AbstractRepositorySettingsPage paramAbstractRepositorySettingsPage, String $anonymous0, String $anonymous1, int $anonymous2, Composite $anonymous3)
  {
    super($anonymous0, $anonymous1, $anonymous2, $anonymous3);
  }
  
  public int getNumberOfControls()
  {
    return 3;
  }
}

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

import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class AbstractRepositorySettingsPage$6
  extends SelectionAdapter
{
  AbstractRepositorySettingsPage$6(AbstractRepositorySettingsPage paramAbstractRepositorySettingsPage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    super.widgetSelected(e);
    this$0.isPageComplete();
    if (this$0.getWizard() != null) {
      this$0.getWizard().getContainer().updateButtons();
    }
  }
}

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

import java.util.Comparator;

class AbstractTaskRepositoryPage$ContributionComparator
  implements Comparator<AbstractTaskRepositoryPageContribution>
{
  public int compare(AbstractTaskRepositoryPageContribution o1, AbstractTaskRepositoryPageContribution o2)
  {
    if (o1 == o2) {
      return 0;
    }
    String s1 = o1.getTitle();
    String s2 = o2.getTitle();
    int i = s1.compareTo(s2);
    if (i == 0) {
      i = o1.getId().compareTo(o2.getId());
    }
    return i;
  }
}

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

import org.eclipse.mylyn.commons.ui.dialogs.IValidatable;

class AbstractRepositorySettingsPage$30
  implements IValidatable
{
  AbstractRepositorySettingsPage$30(AbstractRepositorySettingsPage paramAbstractRepositorySettingsPage) {}
  
  public void validate()
  {
    this$0.validateSettings();
  }
  
  public boolean needsValidation()
  {
    return this$0.needsValidation();
  }
  
  public boolean canValidate()
  {
    return this$0.canValidate();
  }
}

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

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

class AbstractRepositoryQueryPage2$5
  extends SelectionAdapter
{
  AbstractRepositoryQueryPage2$5(AbstractRepositoryQueryPage2 paramAbstractRepositoryQueryPage2) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    this$0.doClearControls();
  }
}

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

import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;

class AbstractRepositorySettingsPage$RepositoryStringFieldEditor
  extends StringFieldEditor
{
  public AbstractRepositorySettingsPage$RepositoryStringFieldEditor(String name, String labelText, int style, Composite parent)
  {
    super(name, labelText, style, parent);
  }
  
  public void refreshValidState()
  {
    try
    {
      super.refreshValidState();
    }
    catch (Exception e)
    {
      StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", 
        "Problem refreshing password field", e));
    }
  }
  
  public Text getTextControl()
  {
    return super.getTextControl();
  }
}

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

import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Combo;

class TaskAttachmentPage$4
  implements SelectionListener
{
  TaskAttachmentPage$4(TaskAttachmentPage paramTaskAttachmentPage) {}
  
  public void widgetDefaultSelected(SelectionEvent e) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    TaskAttachmentPage.access$0(this$0).setContentType(TaskAttachmentPage.access$5(this$0).getItem(TaskAttachmentPage.access$5(this$0).getSelectionIndex()));
    TaskAttachmentPage.access$2(this$0);
  }
}

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

import java.util.List;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.osgi.util.NLS;

class AbstractTaskRepositoryPage$2
  extends SafeRunnable
{
  AbstractTaskRepositoryPage$2(AbstractTaskRepositoryPage paramAbstractTaskRepositoryPage, AbstractTaskRepositoryPageContribution paramAbstractTaskRepositoryPageContribution, List paramList) {}
  
  public void run()
    throws Exception
  {
    val$contribution.init(this$0.getConnectorKind(), AbstractTaskRepositoryPage.access$1(this$0));
    val$contribution.addListener(AbstractTaskRepositoryPage.access$2(this$0));
  }
  
  public void handleException(Throwable e)
  {
    val$badContributions.add(val$contribution);
    StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", NLS.bind(
      "Problems occured when initializing contribution \"{0}\"", val$contribution.getId()), e));
  }
}

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

import org.eclipse.mylyn.commons.workbench.browser.BrowserUtil;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class AbstractRepositorySettingsPage$12
  extends HyperlinkAdapter
{
  AbstractRepositorySettingsPage$12(AbstractRepositorySettingsPage paramAbstractRepositorySettingsPage) {}
  
  public void linkActivated(HyperlinkEvent e)
  {
    TaskRepository repository = this$0.getRepository();
    if ((repository == null) && (this$0.getRepositoryUrl() != null) && (this$0.getRepositoryUrl().length() > 0)) {
      repository = this$0.createTaskRepository();
    }
    if (repository != null)
    {
      String accountManagementUrl = TasksUiPlugin.getConnectorUi(this$0.connector.getConnectorKind())
        .getAccountManagementUrl(repository);
      if (accountManagementUrl != null) {
        BrowserUtil.openUrl(accountManagementUrl, 128);
      }
    }
  }
}

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

import java.lang.reflect.InvocationTargetException;
import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedMap;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.dialogs.IValidatable;
import org.eclipse.mylyn.commons.ui.dialogs.ValidatableWizardDialog;
import org.eclipse.mylyn.commons.workbench.browser.BrowserUtil;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
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.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.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.statushandlers.StatusManager;

public abstract class AbstractRepositorySettingsPage
  extends AbstractTaskRepositoryPage
  implements ITaskRepositoryPage, IAdaptable
{
  protected static final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences";
  protected static final String LABEL_REPOSITORY_LABEL = Messages.AbstractRepositorySettingsPage_Label_;
  protected static final String LABEL_SERVER = Messages.AbstractRepositorySettingsPage_Server_;
  protected static final String LABEL_USER = Messages.AbstractRepositorySettingsPage_User_ID_;
  protected static final String LABEL_PASSWORD = Messages.AbstractRepositorySettingsPage_Password_;
  protected static final String URL_PREFIX_HTTPS = "https://";
  protected static final String URL_PREFIX_HTTP = "http://";
  protected static final String INVALID_REPOSITORY_URL = Messages.AbstractRepositorySettingsPage_Repository_url_is_invalid;
  protected static final String INVALID_LOGIN = Messages.AbstractRepositorySettingsPage_Unable_to_authenticate_with_repository;
  protected AbstractRepositoryConnector connector;
  protected StringFieldEditor repositoryLabelEditor;
  protected Combo serverUrlCombo;
  private String serverVersion = "unknown";
  protected StringFieldEditor repositoryUserNameEditor;
  protected StringFieldEditor repositoryPasswordEditor;
  protected StringFieldEditor httpAuthUserNameEditor;
  protected StringFieldEditor httpAuthPasswordEditor;
  private StringFieldEditor certAuthFileNameEditor;
  private Button certBrowseButton;
  private StringFieldEditor certAuthPasswordEditor;
  protected StringFieldEditor proxyHostnameEditor;
  protected StringFieldEditor proxyPortEditor;
  protected StringFieldEditor proxyUserNameEditor;
  protected StringFieldEditor proxyPasswordEditor;
  protected TaskRepository repository;
  private Combo otherEncodingCombo;
  private Button defaultEncoding;
  protected Button anonymousButton;
  private String oldUsername;
  private String oldPassword;
  private String oldHttpAuthUserId;
  private String oldHttpAuthPassword;
  private String oldCertAuthFileName;
  private String oldCertAuthPassword;
  private boolean needsAnonymousLogin;
  private boolean needsTimeZone;
  private boolean needsEncoding;
  private boolean needsCertAuth;
  private boolean needsHttpAuth;
  private boolean needsValidation;
  private boolean needsValidateOnFinish;
  private boolean needsAdvanced;
  protected Composite compositeContainer;
  private Composite advancedComp;
  private Composite certAuthComp;
  private Composite httpAuthComp;
  private Composite proxyAuthComp;
  private Set<String> repositoryUrls;
  private String originalUrl;
  private Button otherEncoding;
  private Button certAuthButton;
  private Button httpAuthButton;
  private boolean needsProxy;
  private Button systemProxyButton;
  private String oldProxyUsername = "";
  private String oldProxyPassword = "";
  private String oldProxyHostname = "";
  private String oldProxyPort = "";
  private Button proxyAuthButton;
  private Hyperlink createAccountHyperlink;
  private Hyperlink manageAccountHyperlink;
  protected Button savePasswordButton;
  private Button saveHttpPasswordButton;
  private Button saveCertPasswordButton;
  private Button saveProxyPasswordButton;
  private Button disconnectedButton;
  private Button validateOnFinishButton;
  private boolean isValid;
  
  public AbstractRepositorySettingsPage(String title, String description, TaskRepository taskRepository)
  {
    super(title, description, taskRepository);
    repository = taskRepository;
    connector = TasksUi.getRepositoryManager().getRepositoryConnector(getConnectorKind());
    setNeedsAnonymousLogin(false);
    setNeedsEncoding(true);
    setNeedsTimeZone(true);
    setNeedsProxy(true);
    setNeedsValidation(true);
    setNeedsAdvanced(true);
    setNeedsValidateOnFinish(false);
  }
  
  public abstract String getConnectorKind();
  
  public void dispose()
  {
    super.dispose();
  }
  
  public void createControl(Composite parent)
  {
    initializeDialogUnits(parent);
    toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
    
    Composite compositeContainer = new Composite(parent, 0);
    GridLayout layout = new GridLayout(3, false);
    compositeContainer.setLayout(layout);
    
    createSettingControls(compositeContainer);
    createValidationControls(compositeContainer);
    if (needsValidateOnFinish())
    {
      validateOnFinishButton = new Button(compositeContainer, 32);
      validateOnFinishButton.setText(Messages.AbstractRepositorySettingsPage_Validate_on_Finish);
      validateOnFinishButton.setSelection(true);
    }
    Dialog.applyDialogFont(compositeContainer);
    setControl(compositeContainer);
  }
  
  protected void createValidationControls(Composite parent)
  {
    if ((!needsValidation()) || ((getContainer() instanceof ValidatableWizardDialog)) || 
      ((getContainer() instanceof TaskRepositoryWizardDialog))) {
      return;
    }
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout(1, false);
    marginHeight = 10;
    marginWidth = 0;
    horizontalSpacing = 10;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(16384, 128, false, false, 3, 1));
    
    Button validateButton = new Button(composite, 8);
    validateButton.setImage(CommonImages.getImage(CommonImages.VALIDATE));
    validateButton.setText(Messages.AbstractRepositorySettingsPage_Validate_Settings_Button_Label);
    validateButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        validateSettings();
      }
    });
  }
  
  protected void createSettingControls(Composite parent)
  {
    compositeContainer = parent;
    
    initializeOldValues();
    
    Label serverLabel = new Label(compositeContainer, 0);
    serverLabel.setText(LABEL_SERVER);
    serverUrlCombo = new Combo(compositeContainer, 4);
    serverUrlCombo.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        if (getWizard() != null) {
          getWizard().getContainer().updateButtons();
        }
      }
    });
    serverUrlCombo.addFocusListener(new FocusAdapter()
    {
      public void focusLost(FocusEvent e)
      {
        AbstractRepositorySettingsPage.this.updateHyperlinks();
      }
    });
    serverUrlCombo.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        if (getWizard() != null) {
          getWizard().getContainer().updateButtons();
        }
      }
    });GridDataFactory.fillDefaults().hint(300, -1).grab(true, false).span(2, -1)
      .applyTo(serverUrlCombo);
    
    repositoryLabelEditor = new StringFieldEditor("", LABEL_REPOSITORY_LABEL, StringFieldEditor.UNLIMITED, 
      compositeContainer)
      {
        protected boolean doCheckState()
        {
          return true;
        }
        
        protected void valueChanged()
        {
          super.valueChanged();
          if (getWizard() != null) {
            getWizard().getContainer().updateButtons();
          }
        }
        
        public int getNumberOfControls()
        {
          return 2;
        }
      };
      disconnectedButton = new Button(compositeContainer, 32);
      disconnectedButton.setText(Messages.AbstractRepositorySettingsPage_Disconnected);
      disconnectedButton.setSelection(repository != null ? repository.isOffline() : false);
      disconnectedButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          super.widgetSelected(e);
          isPageComplete();
          if (getWizard() != null) {
            getWizard().getContainer().updateButtons();
          }
        }
      });
      repositoryUserNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, 
        compositeContainer)
        {
          protected boolean doCheckState()
          {
            return true;
          }
          
          protected void valueChanged()
          {
            super.valueChanged();
            isPageComplete();
            if (getWizard() != null) {
              getWizard().getContainer().updateButtons();
            }
          }
          
          public int getNumberOfControls()
          {
            return 2;
          }
        };
        if (needsAnonymousLogin())
        {
          anonymousButton = new Button(compositeContainer, 32);
          
          anonymousButton.setText(Messages.AbstractRepositorySettingsPage_Anonymous_Access);
          anonymousButton.addSelectionListener(new SelectionAdapter()
          {
            public void widgetSelected(SelectionEvent e)
            {
              setAnonymous(anonymousButton.getSelection());
              isPageComplete();
            }
          });
        }
        else
        {
          Label dummyLabel = new Label(compositeContainer, 0);
          GridDataFactory.fillDefaults().applyTo(dummyLabel);
        }
        repositoryPasswordEditor = new RepositoryStringFieldEditor("", LABEL_PASSWORD, StringFieldEditor.UNLIMITED, 
          compositeContainer)
          {
            protected boolean doCheckState()
            {
              return true;
            }
            
            protected void valueChanged()
            {
              super.valueChanged();
              isPageComplete();
              if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
              }
            }
            
            public int getNumberOfControls()
            {
              return 2;
            }
          };
          savePasswordButton = new Button(compositeContainer, 32);
          savePasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password);
          savePasswordButton.addSelectionListener(new SelectionAdapter()
          {
            public void widgetSelected(SelectionEvent e)
            {
              super.widgetSelected(e);
              isPageComplete();
              if (getWizard() != null) {
                getWizard().getContainer().updateButtons();
              }
            }
          });
          if (repository != null) {
            try
            {
              String repositoryLabel = repository.getProperty("label");
              if ((repositoryLabel != null) && (repositoryLabel.length() > 0)) {
                repositoryLabelEditor.setStringValue(repositoryLabel);
              }
              serverUrlCombo.setText(repository.getRepositoryUrl());
              AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY);
              if (credentials != null)
              {
                repositoryUserNameEditor.setStringValue(credentials.getUserName());
                repositoryPasswordEditor.setStringValue(credentials.getPassword());
              }
              else
              {
                repositoryUserNameEditor.setStringValue("");
                repositoryPasswordEditor.setStringValue("");
              }
            }
            catch (Throwable t)
            {
              StatusHandler.log(new Status(4, "org.eclipse.mylyn.tasks.ui", "Could not set field value", t));
            }
          }
          if (needsAnonymousLogin()) {
            if (repository != null) {
              setAnonymous(repository.getCredentials(AuthenticationType.REPOSITORY) == null);
            } else {
              setAnonymous(true);
            }
          }
          if (repository != null) {
            savePasswordButton.setSelection(repository.getSavePassword(AuthenticationType.REPOSITORY));
          } else {
            savePasswordButton.setSelection(false);
          }
          if ((needsAdvanced()) || (needsEncoding())) {
            createAdvancedSection();
          }
          if (needsCertAuth()) {
            createCertAuthSection();
          }
          if (needsHttpAuth()) {
            createHttpAuthSection();
          }
          if (needsProxy()) {
            createProxySection();
          }
          createContributionControls(parent);
          
          Composite managementComposite = new Composite(compositeContainer, 0);
          GridLayout managementLayout = new GridLayout(4, false);
          marginHeight = 0;
          marginWidth = 0;
          horizontalSpacing = 10;
          managementComposite.setLayout(managementLayout);
          managementComposite.setLayoutData(new GridData(16384, 128, false, false, 2, 1));
          
          createAccountHyperlink = toolkit.createHyperlink(managementComposite, 
            Messages.AbstractRepositorySettingsPage_Create_new_account, 0);
          createAccountHyperlink.setBackground(managementComposite.getBackground());
          createAccountHyperlink.addHyperlinkListener(new HyperlinkAdapter()
          {
            public void linkActivated(HyperlinkEvent e)
            {
              TaskRepository repository = createTaskRepository();
              if (repository != null)
              {
                String accountCreationUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
                  .getAccountCreationUrl(repository);
                if (accountCreationUrl != null) {
                  BrowserUtil.openUrl(accountCreationUrl, 128);
                }
              }
            }
          });
          manageAccountHyperlink = toolkit.createHyperlink(managementComposite, 
            Messages.AbstractRepositorySettingsPage_Change_account_settings, 0);
          manageAccountHyperlink.setBackground(managementComposite.getBackground());
          manageAccountHyperlink.addHyperlinkListener(new HyperlinkAdapter()
          {
            public void linkActivated(HyperlinkEvent e)
            {
              TaskRepository repository = getRepository();
              if ((repository == null) && (getRepositoryUrl() != null) && (getRepositoryUrl().length() > 0)) {
                repository = createTaskRepository();
              }
              if (repository != null)
              {
                String accountManagementUrl = TasksUiPlugin.getConnectorUi(connector.getConnectorKind())
                  .getAccountManagementUrl(repository);
                if (accountManagementUrl != null) {
                  BrowserUtil.openUrl(accountManagementUrl, 128);
                }
              }
            }
          });
          ((RepositoryStringFieldEditor)repositoryPasswordEditor).getTextControl().setEchoChar('*');
          if (needsAnonymousLogin()) {
            if (repository != null) {
              setAnonymous(isAnonymousAccess());
            }
          }
          updateHyperlinks();
          
          GridLayout layout = new GridLayout(3, false);
          compositeContainer.setLayout(layout);
        }
        
        private void createAdvancedSection()
        {
          ExpandableComposite section = createSection(compositeContainer, 
            Messages.AbstractRepositorySettingsPage_Additional_Settings);
          
          advancedComp = toolkit.createComposite(section, 0);
          GridLayout gridLayout2 = new GridLayout();
          numColumns = 2;
          verticalSpacing = 5;
          marginWidth = 0;
          advancedComp.setLayout(gridLayout2);
          advancedComp.setBackground(compositeContainer.getBackground());
          section.setClient(advancedComp);
          
          createAdditionalControls(advancedComp);
          if (needsEncoding())
          {
            Label encodingLabel = new Label(advancedComp, 256);
            encodingLabel.setText(Messages.AbstractRepositorySettingsPage_Character_encoding);
            GridDataFactory.fillDefaults().align(1, 128).applyTo(encodingLabel);
            
            Composite encodingContainer = new Composite(advancedComp, 0);
            GridLayout gridLayout = new GridLayout(2, false);
            marginWidth = 0;
            marginHeight = 0;
            encodingContainer.setLayout(gridLayout);
            
            defaultEncoding = new Button(encodingContainer, 16);
            defaultEncoding.setLayoutData(new GridData(16384, 16777216, false, false, 2, 1));
            defaultEncoding.setText(Messages.AbstractRepositorySettingsPage_Default__ + 
              "UTF-8" + ")");
            defaultEncoding.setSelection(true);
            
            otherEncoding = new Button(encodingContainer, 16);
            otherEncoding.setText(Messages.AbstractRepositorySettingsPage_Other);
            otherEncodingCombo = new Combo(encodingContainer, 8);
            try
            {
              for (String encoding : Charset.availableCharsets().keySet()) {
                if (!encoding.equals("UTF-8")) {
                  otherEncodingCo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79

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