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

       repositoryUrls = new HashSet(repositories.size());
                              for (TaskRepository repository : repositories) {
                                repositoryUrls.add(repository.getRepositoryUrl());
                              }
                            }
                            if (repositoryUrls.contains(urlString)) {
                              return Messages.AbstractRepositorySettingsPage_Repository_already_exists;
                            }
                          }
                          return null;
                        }
                        
                        @Deprecated
                        public void setRepository(TaskRepository repository)
                        {
                          this.repository = repository;
                        }
                        
                        public void setVersion(String previousVersion)
                        {
                          if (previousVersion == null) {
                            serverVersion = "unknown";
                          } else {
                            serverVersion = previousVersion;
                          }
                        }
                        
                        public String getVersion()
                        {
                          return serverVersion;
                        }
                        
                        public TaskRepository getRepository()
                        {
                          return repository;
                        }
                        
                        public String getCharacterEncoding()
                        {
                          if (defaultEncoding == null) {
                            return null;
                          }
                          if (defaultEncoding.getSelection()) {
                            return "UTF-8";
                          }
                          if (otherEncodingCombo.getSelectionIndex() > -1) {
                            return otherEncodingCombo.getItem(otherEncodingCombo.getSelectionIndex());
                          }
                          return "UTF-8";
                        }
                        
                        public TaskRepository createTaskRepository()
                        {
                          TaskRepository repository = new TaskRepository(connector.getConnectorKind(), getRepositoryUrl());
                          applyTo(repository);
                          return repository;
                        }
                        
                        public void applyTo(TaskRepository repository)
                        {
                          repository.setVersion(getVersion());
                          if (needsEncoding()) {
                            repository.setCharacterEncoding(getCharacterEncoding());
                          }
                          if (isAnonymousAccess())
                          {
                            repository.setCredentials(AuthenticationType.REPOSITORY, null, getSavePassword().booleanValue());
                          }
                          else
                          {
                            AuthenticationCredentials credentials = new AuthenticationCredentials(getUserName(), getPassword());
                            repository.setCredentials(AuthenticationType.REPOSITORY, credentials, getSavePassword().booleanValue());
                          }
                          repository.setRepositoryLabel(getRepositoryLabel());
                          if (needsCertAuth()) {
                            if (getCertAuth())
                            {
                              AuthenticationCredentials webCredentials = new AuthenticationCredentials(getCertAuthFileName(), 
                                getCertAuthPassword());
                              repository.setCredentials(AuthenticationType.CERTIFICATE, webCredentials, getSaveCertPassword().booleanValue());
                            }
                            else
                            {
                              repository.setCredentials(AuthenticationType.CERTIFICATE, null, getSaveCertPassword().booleanValue());
                            }
                          }
                          if (needsHttpAuth()) {
                            if (getHttpAuth())
                            {
                              AuthenticationCredentials webCredentials = new AuthenticationCredentials(getHttpAuthUserId(), 
                                getHttpAuthPassword());
                              repository.setCredentials(AuthenticationType.HTTP, webCredentials, getSaveHttpPassword().booleanValue());
                            }
                            else
                            {
                              repository.setCredentials(AuthenticationType.HTTP, null, getSaveHttpPassword().booleanValue());
                            }
                          }
                          if (needsProxy())
                          {
                            repository.setDefaultProxyEnabled(getUseDefaultProxy().booleanValue());
                            repository.setProperty("org.eclipse.mylyn.tasklist.repositories.proxy.hostname", getProxyHostname());
                            repository.setProperty("org.eclipse.mylyn.tasklist.repositories.proxy.port", getProxyPort());
                            if (getProxyAuth())
                            {
                              AuthenticationCredentials webCredentials = new AuthenticationCredentials(getProxyUserName(), 
                                getProxyPassword());
                              repository.setCredentials(AuthenticationType.PROXY, webCredentials, getSaveProxyPassword().booleanValue());
                            }
                            else
                            {
                              repository.setCredentials(AuthenticationType.PROXY, null, getSaveProxyPassword().booleanValue());
                            }
                          }
                          if (disconnectedButton != null) {
                            repository.setOffline(disconnectedButton.getSelection());
                          }
                          super.applyTo(repository);
                        }
                        
                        public AbstractRepositoryConnector getConnector()
                        {
                          return connector;
                        }
                        
                        public boolean needsEncoding()
                        {
                          return needsEncoding;
                        }
                        
                        public boolean needsTimeZone()
                        {
                          return needsTimeZone;
                        }
                        
                        public boolean needsAnonymousLogin()
                        {
                          return needsAnonymousLogin;
                        }
                        
                        public boolean needsAdvanced()
                        {
                          return needsAdvanced;
                        }
                        
                        public void setNeedsEncoding(boolean needsEncoding)
                        {
                          this.needsEncoding = needsEncoding;
                        }
                        
                        public void setNeedsTimeZone(boolean needsTimeZone)
                        {
                          this.needsTimeZone = needsTimeZone;
                        }
                        
                        public void setNeedsAdvanced(boolean needsAdvanced)
                        {
                          this.needsAdvanced = needsAdvanced;
                        }
                        
                        public boolean needsCertAuth()
                        {
                          return needsCertAuth;
                        }
                        
                        public void setNeedsCertAuth(boolean needsCertificate)
                        {
                          needsCertAuth = needsCertificate;
                        }
                        
                        public boolean needsHttpAuth()
                        {
                          return needsHttpAuth;
                        }
                        
                        public void setNeedsHttpAuth(boolean needsHttpAuth)
                        {
                          this.needsHttpAuth = needsHttpAuth;
                        }
                        
                        public void setNeedsProxy(boolean needsProxy)
                        {
                          this.needsProxy = needsProxy;
                        }
                        
                        public boolean needsProxy()
                        {
                          return needsProxy;
                        }
                        
                        public void setNeedsAnonymousLogin(boolean needsAnonymousLogin)
                        {
                          this.needsAnonymousLogin = needsAnonymousLogin;
                        }
                        
                        public void setNeedsValidation(boolean needsValidation)
                        {
                          this.needsValidation = needsValidation;
                        }
                        
                        public boolean canValidate()
                        {
                          return true;
                        }
                        
                        public boolean needsValidation()
                        {
                          return needsValidation;
                        }
                        
                        public void setUrl(String url)
                        {
                          serverUrlCombo.setText(url);
                        }
                        
                        public void setUserId(String id)
                        {
                          repositoryUserNameEditor.setStringValue(id);
                        }
                        
                        public void setPassword(String pass)
                        {
                          repositoryPasswordEditor.setStringValue(pass);
                        }
                        
                        public Boolean getSavePassword()
                        {
                          return Boolean.valueOf(savePasswordButton.getSelection());
                        }
                        
                        public Boolean getSaveProxyPassword()
                        {
                          if (needsProxy()) {
                            return Boolean.valueOf(saveProxyPasswordButton.getSelection());
                          }
                          return Boolean.valueOf(false);
                        }
                        
                        public Boolean getSaveCertPassword()
                        {
                          if (needsCertAuth()) {
                            return Boolean.valueOf(saveCertPasswordButton.getSelection());
                          }
                          return Boolean.valueOf(false);
                        }
                        
                        public Boolean getSaveHttpPassword()
                        {
                          if (needsHttpAuth()) {
                            return Boolean.valueOf(saveHttpPasswordButton.getSelection());
                          }
                          return Boolean.valueOf(false);
                        }
                        
                        protected void validateSettings()
                        {
                          final Validator validator = getValidator(createTaskRepository());
                          if (validator == null) {
                            return;
                          }
                          try
                          {
                            getWizard().getContainer().run(true, true, new IRunnableWithProgress()
                            {
                              /* Error */
                              public void run(IProgressMonitor monitor)
                                throws InvocationTargetException, InterruptedException
                              {
                                // Byte code:
                                //   0: aload_1
                                //   1: getstatic 72	org/eclipse/mylyn/internal/tasks/ui/wizards/Messages:AbstractRepositorySettingsPage_Validating_server_settings	Ljava/lang/String;
                                //   4: iconst_m1
                                //   5: invokeinterface 83 3 0
                                //   10: aload_0
                                //   11: getfield 74	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$29:val$validator	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator;
                                //   14: aload_1
                                //   15: invokevirtual 79	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator:run	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
                                //   18: aload_0
                                //   19: getfield 74	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$29:val$validator	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator;
                                //   22: invokevirtual 80	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator:getStatus	()Lorg/eclipse/core/runtime/IStatus;
                                //   25: ifnonnull +75 -> 100
                                //   28: aload_0
                                //   29: getfield 74	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$29:val$validator	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator;
                                //   32: getstatic 71	org/eclipse/core/runtime/Status:OK_STATUS	Lorg/eclipse/core/runtime/IStatus;
                                //   35: invokevirtual 81	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator:setStatus	(Lorg/eclipse/core/runtime/IStatus;)V
                                //   38: goto +62 -> 100
                                //   41: astore_2
                                //   42: aload_0
                                //   43: getfield 74	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$29:val$validator	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator;
                                //   46: aload_2
                                //   47: invokevirtual 78	org/eclipse/core/runtime/CoreException:getStatus	()Lorg/eclipse/core/runtime/IStatus;
                                //   50: invokevirtual 81	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator:setStatus	(Lorg/eclipse/core/runtime/IStatus;)V
                                //   53: aload_1
                                //   54: invokeinterface 82 1 0
                                //   59: goto +47 -> 106
                                //   62: pop
                                //   63: aload_0
                                //   64: getfield 74	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$29:val$validator	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator;
                                //   67: getstatic 70	org/eclipse/core/runtime/Status:CANCEL_STATUS	Lorg/eclipse/core/runtime/IStatus;
                                //   70: invokevirtual 81	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage$Validator:setStatus	(Lorg/eclipse/core/runtime/IStatus;)V
                                //   73: new 31	java/lang/InterruptedException
                                //   76: dup
                                //   77: invokespecial 75	java/lang/InterruptedException:<init>	()V
                                //   80: athrow
                                //   81: astore_2
                                //   82: new 33	java/lang/reflect/InvocationTargetException
                                //   85: dup
                                //   86: aload_2
                                //   87: invokespecial 77	java/lang/reflect/InvocationTargetException:<init>	(Ljava/lang/Throwable;)V
                                //   90: athrow
                                //   91: astore_3
                                //   92: aload_1
                                //   93: invokeinterface 82 1 0
                                //   98: aload_3
                                //   99: athrow
                                //   100: aload_1
                                //   101: invokeinterface 82 1 0
                                //   106: return
                                // Line number table:
                                //   Java source line #1904	-> byte code offset #0
                                //   Java source line #1905	-> byte code offset #4
                                //   Java source line #1904	-> byte code offset #5
                                //   Java source line #1907	-> byte code offset #10
                                //   Java source line #1908	-> byte code offset #18
                                //   Java source line #1909	-> byte code offset #28
                                //   Java source line #1911	-> byte code offset #41
                                //   Java source line #1912	-> byte code offset #42
                                //   Java source line #1919	-> byte code offset #53
                                //   Java source line #1913	-> byte code offset #62
                                //   Java source line #1914	-> byte code offset #63
                                //   Java source line #1915	-> byte code offset #73
                                //   Java source line #1916	-> byte code offset #81
                                //   Java source line #1917	-> byte code offset #82
                                //   Java source line #1918	-> byte code offset #91
                                //   Java source line #1919	-> byte code offset #92
                                //   Java source line #1920	-> byte code offset #98
                                //   Java source line #1919	-> byte code offset #100
                                //   Java source line #1921	-> byte code offset #106
                                // Local variable table:
                                //   start	length	slot	name	signature
                                //   0	107	0	this	29
                                //   0	107	1	monitor	IProgressMonitor
                                //   41	6	2	e	CoreException
                                //   81	6	2	e	Exception
                                //   91	8	3	localObject	Object
                                //   62	1	5	localOperationCanceledException	org.eclipse.core.runtime.OperationCanceledException
                                // Exception table:
                                //   from	to	target	type
                                //   10	38	41	org/eclipse/core/runtime/CoreException
                                //   10	38	62	org/eclipse/core/runtime/OperationCanceledException
                                //   10	38	81	java/lang/Exception
                                //   10	53	91	finally
                                //   62	91	91	finally
                              }
                            });
                          }
                          catch (InvocationTargetException e)
                          {
                            StatusManager.getManager().handle(
                              new Status(4, "org.eclipse.mylyn.tasks.ui", 
                              Messages.AbstractRepositorySettingsPage_Internal_error_validating_repository, e), 
                              3);
                            return;
                          }
                          catch (InterruptedException localInterruptedException)
                          {
                            return;
                          }
                          getWizard().getContainer().updateButtons();
                          applyValidatorResult(validator);
                        }
                        
                        protected IStatus validate()
                        {
                          return null;
                        }
                        
                        protected void applyValidatorResult(Validator validator)
                        {
                          IStatus status = validator.getStatus();
                          String message = status.getMessage();
                          if ((message == null) || (message.length() == 0)) {
                            message = null;
                          }
                          switch (status.getSeverity())
                          {
                          case 0: 
                            if (status == Status.OK_STATUS) {
                              if (getUserName().length() > 0) {
                                message = Messages.AbstractRepositorySettingsPage_Authentication_credentials_are_valid;
                              } else {
                                message = Messages.AbstractRepositorySettingsPage_Repository_is_valid;
                              }
                            }
                            setMessage(message, 1);
                            break;
                          case 1: 
                            setMessage(message, 1);
                            break;
                          case 2: 
                            setMessage(message, 2);
                            break;
                          default: 
                            setMessage(message, 3);
                          }
                          setErrorMessage(null);
                          
                          isValid = ((status.getSeverity() == 0) || (status.getSeverity() == 1));
                        }
                        
                        protected abstract Validator getValidator(TaskRepository paramTaskRepository);
                        
                        public abstract class Validator
                        {
                          private IStatus status;
                          
                          public Validator() {}
                          
                          public abstract void run(IProgressMonitor paramIProgressMonitor)
                            throws CoreException;
                          
                          public IStatus getStatus()
                          {
                            return status;
                          }
                          
                          public void setStatus(IStatus status)
                          {
                            this.status = status;
                          }
                        }
                        
                        public Object getAdapter(Class adapter)
                        {
                          if (adapter == IValidatable.class) {
                            new IValidatable()
                            {
                              public void validate()
                              {
                                validateSettings();
                              }
                              
                              public boolean needsValidation()
                              {
                                return AbstractRepositorySettingsPage.this.needsValidation();
                              }
                              
                              public boolean canValidate()
                              {
                                return AbstractRepositorySettingsPage.this.canValidate();
                              }
                            };
                          }
                          return null;
                        }
                        
                        public boolean needsValidateOnFinish()
                        {
                          return needsValidateOnFinish;
                        }
                        
                        public void setNeedsValidateOnFinish(boolean needsValidateOnFinish)
                        {
                          this.needsValidateOnFinish = needsValidateOnFinish;
                        }
                        
                        public boolean preFinish(TaskRepository repository)
                        {
                          if ((validateOnFinishButton != null) && (validateOnFinishButton.getSelection()))
                          {
                            isValid = false;
                            validateSettings();
                          }
                          else
                          {
                            isValid = true;
                          }
                          if (isValid) {
                            isValid = super.preFinish(repository);
                          }
                          return isValid;
                        }
                      }

/* Location:
 * Qualified Name:     org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage
 * 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.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.ProgressMonitorPart;
import org.eclipse.mylyn.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.commons.ui.ProgressContainer;
import org.eclipse.mylyn.commons.workbench.forms.SectionComposite;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
import org.eclipse.mylyn.internal.tasks.ui.wizards.QueryWizardDialog;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
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.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;

public abstract class AbstractRepositoryQueryPage2
  extends AbstractRepositoryQueryPage
{
  private Button cancelButton;
  private final AbstractRepositoryConnector connector;
  private boolean firstTime = true;
  private SectionComposite innerComposite;
  private boolean needsClear;
  private boolean needsRefresh = true;
  private ProgressContainer progressContainer;
  private Button refreshButton;
  private Text titleText;
  
  public AbstractRepositoryQueryPage2(String pageName, TaskRepository repository, IRepositoryQuery query)
  {
    super(pageName, repository, query);
    connector = TasksUi.getRepositoryConnector(getTaskRepository().getConnectorKind());
    setTitle(Messages.AbstractRepositoryQueryPage2_Enter_query_parameters);
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridDataFactory.fillDefaults().align(4, 4).grab(true, true).applyTo(composite);
    GridLayout layout = new GridLayout(2, false);
    if (inSearchContainer())
    {
      marginWidth = 0;
      marginHeight = 0;
    }
    composite.setLayout(layout);
    
    createTitleGroup(composite);
    
    innerComposite = new SectionComposite(composite, 0);
    GridDataFactory.fillDefaults().align(4, 4).grab(true, true).span(2, 1).applyTo(innerComposite);
    createPageContent(innerComposite);
    
    createButtonGroup(composite);
    if (!needsRefresh) {
      setDescription(Messages.AbstractRepositoryQueryPage2_Create_a_Query_Page_Description);
    }
    Dialog.applyDialogFont(composite);
    setControl(composite);
  }
  
  public String getQueryTitle()
  {
    return titleText != null ? titleText.getText() : null;
  }
  
  public boolean handleExtraButtonPressed(int buttonId)
  {
    if (buttonId == 2001)
    {
      if (getTaskRepository() != null) {
        refreshConfiguration(true);
      } else {
        MessageDialog.openInformation(
          Display.getCurrent().getActiveShell(), 
          Messages.AbstractRepositoryQueryPage2_Update_Attributes_Failed, 
          Messages.AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view);
      }
      return true;
    }
    if (buttonId == 2002)
    {
      doClearControls();
      return true;
    }
    return false;
  }
  
  public boolean isPageComplete()
  {
    if ((titleText != null) && (titleText.getText().length() > 0)) {
      return true;
    }
    setMessage(Messages.AbstractRepositoryQueryPage2_Enter_a_title);
    return false;
  }
  
  public boolean needsClear()
  {
    return needsClear;
  }
  
  public boolean needsRefresh()
  {
    return needsRefresh;
  }
  
  public boolean performSearch()
  {
    if (inSearchContainer()) {
      saveState();
    }
    return super.performSearch();
  }
  
  public void saveState()
  {
    if (inSearchContainer())
    {
      RepositoryQuery query = new RepositoryQuery(getTaskRepository().getConnectorKind(), "handle");
      applyTo(query);
      
      IDialogSettings settings = getDialogSettings();
      if (settings != null) {
        settings.put(getSavedStateSettingKey(), query.getUrl());
      }
    }
  }
  
  public void setExtraButtonState(Button button)
  {
    Integer obj = (Integer)button.getData();
    if (obj.intValue() == 2001)
    {
      if (needsRefresh)
      {
        if (!button.isVisible()) {
          button.setVisible(true);
        }
        button.setEnabled(true);
      }
      else if ((button != null) && (button.isVisible()))
      {
        button.setVisible(false);
      }
    }
    else if (obj.intValue() == 2002)
    {
      if (!button.isVisible()) {
        button.setVisible(true);
      }
      button.setEnabled(true);
    }
  }
  
  public void setNeedsClear(boolean needsClearButton)
  {
    needsClear = needsClearButton;
  }
  
  public void setNeedsRefresh(boolean needsRefresh)
  {
    this.needsRefresh = needsRefresh;
  }
  
  public void setQueryTitle(String text)
  {
    if (titleText != null) {
      titleText.setText(text);
    }
  }
  
  public void setVisible(boolean visible)
  {
    super.setVisible(visible);
    if (getSearchContainer() != null) {
      getSearchContainer().setPerformActionEnabled(true);
    }
    if ((visible) && (firstTime))
    {
      firstTime = false;
      if ((!hasRepositoryConfiguration()) && (needsRefresh)) {
        Display.getDefault().asyncExec(new Runnable()
        {
          public void run()
          {
            if ((getControl() != null) && (!getControl().isDisposed())) {
              AbstractRepositoryQueryPage2.this.initializePage();
            }
          }
        });
      } else {
        initializePage();
      }
    }
  }
  
  private void createButtonGroup(Composite parent)
  {
    Composite buttonComposite = new Composite(parent, 0);
    GridLayout layout = new GridLayout(1, false);
    marginWidth = 0;
    marginHeight = 0;
    buttonComposite.setLayout(layout);
    GridDataFactory.fillDefaults().align(4, 128).grab(true, false).span(2, 1).applyTo(buttonComposite);
    createButtons(buttonComposite);
    if (buttonComposite.getChildren().length > 0) {
      numColumns = buttonComposite.getChildren().length;
    } else {
      buttonComposite.dispose();
    }
  }
  
  private void createTitleGroup(Composite control)
  {
    if (inSearchContainer()) {
      return;
    }
    Label titleLabel = new Label(control, 0);
    titleLabel.setText(Messages.AbstractRepositoryQueryPage2__Title_);
    
    titleText = new Text(control, 2048);
    GridDataFactory.fillDefaults().align(4, 128).grab(true, false).applyTo(titleText);
    titleText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        getContainer().updateButtons();
      }
    });
  }
  
  private void initializePage()
  {
    if (needsRefresh)
    {
      boolean refreshed = refreshConfiguration(false);
      if (!refreshed) {
        doRefreshControls();
      }
    }
    boolean restored = false;
    if (getQuery() != null)
    {
      titleText.setText(getQuery().getSummary());
      restored |= restoreState(getQuery());
    }
    else if (inSearchContainer())
    {
      restored |= restoreSavedState();
    }
    if (!restored) {
      doClearControls();
    }
  }
  
  protected boolean refreshConfiguration(boolean force)
  {
    if ((force) || (!hasRepositoryConfiguration()))
    {
      setErrorMessage(null);
      try
      {
        doRefreshConfiguration();
        doRefreshControls();
        return true;
      }
      catch (InvocationTargetException e)
      {
        if ((e.getCause() instanceof CoreException)) {
          setErrorMessage(((CoreException)e.getCause()).getStatus().getMessage());
        } else {
          setErrorMessage(e.getCause().getMessage());
        }
      }
      catch (InterruptedException localInterruptedException) {}
    }
    return false;
  }
  
  private void doRefreshConfiguration()
    throws InvocationTargetException, InterruptedException
  {
    IRunnableWithProgress runnable = new IRunnableWithProgress()
    {
      /* Error */
      public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
        throws InvocationTargetException, InterruptedException
      {
        // Byte code:
        //   0: aload_1
        //   1: invokestatic 69	org/eclipse/core/runtime/SubMonitor:convert	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/SubMonitor;
        //   4: astore_1
        //   5: aload_1
        //   6: getstatic 64	org/eclipse/mylyn/internal/tasks/ui/wizards/Messages:AbstractRepositoryQueryPage2_Refresh_Configuration_Button_Label	Ljava/lang/String;
        //   9: iconst_m1
        //   10: invokeinterface 74 3 0
        //   15: aload_0
        //   16: getfield 65	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2$3:this$0	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2;
        //   19: invokestatic 72	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2:access$2	(Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2;)Lorg/eclipse/mylyn/tasks/core/AbstractRepositoryConnector;
        //   22: aload_0
        //   23: getfield 65	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2$3:this$0	Lorg/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2;
        //   26: invokevirtual 71	org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositoryQueryPage2:getTaskRepository	()Lorg/eclipse/mylyn/tasks/core/TaskRepository;
        //   29: aload_1
        //   30: invokevirtual 70	org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector:updateRepositoryConfiguration	(Lorg/eclipse/mylyn/tasks/core/TaskRepository;Lorg/eclipse/core/runtime/IProgressMonitor;)V
        //   33: goto +31 -> 64
        //   36: astore_2
        //   37: new 30	java/lang/reflect/InvocationTargetException
        //   40: dup
        //   41: aload_2
        //   42: invokespecial 68	java/lang/reflect/InvocationTargetException:<init>	(Ljava/lang/Throwable;)V
        //   45: athrow
        //   46: pop
        //   47: new 28	java/lang/InterruptedException
        //   50: dup
        //   51: invokespecial 66	java/lang/InterruptedException:<init>	()V
        //   54: athrow
        //   55: astore_3
        //   56: aload_1
        //   57: invokeinterface 73 1 0
        //   62: aload_3
        //   63: athrow
        //   64: aload_1
        //   65: invokeinterface 73 1 0
        //   70: return
        // Line number table:
        //   Java source line #317	-> byte code offset #0
        //   Java source line #318	-> byte code offset #5
        //   Java source line #319	-> byte code offset #9
        //   Java source line #318	-> byte code offset #10
        //   Java source line #321	-> byte code offset #15
        //   Java source line #322	-> byte code offset #36
        //   Java source line #323	-> byte code offset #37
        //   Java source line #324	-> byte code offset #46
        //   Java source line #325	-> byte code offset #47
        //   Java source line #326	-> byte code offset #55
        //   Java source line #327	-> byte code offset #56
        //   Java source line #328	-> byte code offset #62
        //   Java source line #327	-> byte code offset #64
        //   Java source line #329	-> byte code offset #70
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	71	0	this	3
        //   0	71	1	monitor	org.eclipse.core.runtime.IProgressMonitor
        //   36	6	2	e	CoreException
        //   55	8	3	localObject	Object
        //   46	1	4	localOperationCanceledException	org.eclipse.core.runtime.OperationCanceledException
        // Exception table:
        //   from	to	target	type
        //   15	33	36	org/eclipse/core/runtime/CoreException
        //   15	33	46	org/eclipse/core/runtime/OperationCanceledException
        //   15	55	55	finally
      }
    };
    if (getContainer() != null)
    {
      getContainer().run(true, true, runnable);
    }
    else if (progressContainer != null)
    {
      progressContainer.run(true, true, runnable);
    }
    else if (getSearchContainer() != null)
    {
      getSearchContainer().getRunnableContext().run(true, true, runnable);
    }
    else
    {
      IProgressService service = PlatformUI.getWorkbench().getProgressService();
      service.busyCursorWhile(runnable);
    }
  }
  
  protected void createButtons(final Composite composite)
  {
    if ((getContainer() instanceof QueryWizardDialog)) {
      return;
    }
    if (needsRefresh)
    {
      refreshButton = new Button(composite, 8);
      refreshButton.setText(Messages.AbstractRepositoryQueryPage2__Refresh_From_Repository);
      refreshButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          if (getTaskRepository() != null) {
            refreshConfiguration(true);
          } else {
            MessageDialog.openInformation(
              Display.getCurrent().getActiveShell(), 
              Messages.AbstractRepositoryQueryPage2_Update_Attributes_Failed, 
              Messages.AbstractRepositoryQueryPage2_No_repository_available_please_add_one_using_the_Task_Repositories_view);
          }
        }
      
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