org.eclipse.team.ui_3.6.101.R37x_v20111109-0800

ject_page_context");
    
    Label label = new Label(composite, 16384);
    label.setText(description);
    GridData data = new GridData();
    horizontalAlignment = 4;
    label.setLayoutData(data);
    
    table = new Table(composite, 2052);
    data = new GridData(1808);
    heightHint = (table.getItemHeight() * 7);
    table.setLayoutData(data);
    viewer = new TableViewer(table);
    viewer.setContentProvider(new WorkbenchContentProvider());
    viewer.setLabelProvider(new WorkbenchLabelProvider());
    viewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        ISelection selection = event.getSelection();
        if ((selection == null) || (!(selection instanceof IStructuredSelection)))
        {
          selectedWizard = null;
          selectedWizardId = null;
          setPageComplete(false);
          return;
        }
        IStructuredSelection ss = (IStructuredSelection)selection;
        if (ss.size() != 1)
        {
          selectedWizard = null;
          selectedWizardId = null;
          setPageComplete(false);
          return;
        }
        ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement();
        try
        {
          selectedWizard = selectedElement.createExecutableExtension(getUnsharedProjects());
          selectedWizardId = selectedElement.getID();
        }
        catch (CoreException localCoreException)
        {
          return;
        }
        selectedWizard.addPages();
        
        setPageComplete(true);
      }
    });
    viewer.addDoubleClickListener(new IDoubleClickListener()
    {
      public void doubleClick(DoubleClickEvent event)
      {
        getWizard().getContainer().showPage(getNextPage());
      }
    });
    viewer.setComparator(new ViewerComparator()
    {
      public int compare(Viewer viewer, Object e1, Object e2)
      {
        if (((e1 instanceof ConfigurationWizardElement)) && ((e2 instanceof ConfigurationWizardElement)))
        {
          ConfigurationWizardElement wizard1 = (ConfigurationWizardElement)e1;
          ConfigurationWizardElement wizard2 = (ConfigurationWizardElement)e2;
          return wizard1.getLabel(wizard1).compareToIgnoreCase(wizard2.getLabel(wizard2));
        }
        return super.compare(viewer, e1, e2);
      }
    });
    if (disabledWizards.size() > 0)
    {
      showAllToggle = new Button(composite, 32);
      showAllToggle.setText(TeamUIMessages.ConfigureProjectWizard_showAll);
      showAllToggle.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          ArrayList all = new ArrayList(Arrays.asList(wizards.getChildren()));
          if (showAllToggle.getSelection()) {
            all.addAll(Arrays.asList(disabledWizards.getChildren()));
          }
          viewer.setInput(new AdaptableList(all));
        }
      });
    }
    if ((wizards.size() == 0) && (showAllToggle != null))
    {
      showAllToggle.setSelection(true);
      ArrayList all = new ArrayList(Arrays.asList(wizards.getChildren()));
      all.addAll(Arrays.asList(disabledWizards.getChildren()));
      viewer.setInput(new AdaptableList(all));
    }
    else
    {
      viewer.setInput(wizards);
    }
    initializeWizardSelection();
    Dialog.applyDialogFont(parent);
  }
  
  IProject[] getUnsharedProjects()
  {
    List unshared = new ArrayList();
    for (int i = 0; i < projects.length; i++)
    {
      IProject project = projects[i];
      if (!RepositoryProvider.isShared(project)) {
        unshared.add(project);
      }
    }
    return (IProject[])unshared.toArray(new IProject[unshared.size()]);
  }
  
  public IWizardPage getNextPage()
  {
    if (selectedWizard == null) {
      return null;
    }
    if (!WorkbenchActivityHelper.allowUseOf(getTriggerPoint(), ((IStructuredSelection)viewer.getSelection()).getFirstElement())) {
      return null;
    }
    return selectedWizard.getStartingPage();
  }
  
  private ITriggerPoint getTriggerPoint()
  {
    return 
    
      PlatformUI.getWorkbench().getActivitySupport().getTriggerPointManager().getTriggerPoint("org.eclipse.team.ui.activityTriggerPoint");
  }
  
  public void setProjects(IProject[] projects)
  {
    this.projects = projects;
  }
  
  public void setVisible(boolean visible)
  {
    super.setVisible(visible);
    if (visible) {
      table.setFocus();
    }
  }
  
  private void initializeWizardSelection()
  {
    String selectedWizardId = null;
    
    IDialogSettings dialogSettings = TeamUIPlugin.getPlugin().getDialogSettings();
    settings = dialogSettings.getSection("ConfigureProjectWizard");
    if (settings == null) {
      settings = dialogSettings.addNewSection("ConfigureProjectWizard");
    }
    if (settings != null) {
      selectedWizardId = settings.get("selectedWizardId");
    }
    if (selectedWizardId == null) {
      return;
    }
    Object[] children = ((AdaptableList)viewer.getInput()).getChildren();
    for (int i = 0; i < children.length; i++) {
      try
      {
        ConfigurationWizardElement element = (ConfigurationWizardElement)children[i];
        if (element.getID().equals(selectedWizardId))
        {
          viewer.setSelection(new StructuredSelection(element));
          return;
        }
      }
      catch (ClassCastException localClassCastException) {}
    }
  }
  
  void performFinish()
  {
    settings.put("selectedWizardId", selectedWizardId);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ConfigureProjectWizardMainPage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Text;

class ExportProjectSetLocationPage$1
  implements ISelectionChangedListener
{
  final ExportProjectSetLocationPage.WorkspaceDialog this$1;
  
  ExportProjectSetLocationPage$1(ExportProjectSetLocationPage.WorkspaceDialog paramWorkspaceDialog)
  {
    this$1 = paramWorkspaceDialog;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    IStructuredSelection s = (IStructuredSelection)event.getSelection();
    Object obj = s.getFirstElement();
    if ((obj instanceof IContainer))
    {
      this$1.wsContainer = ((IContainer)obj);
    }
    else if ((obj instanceof IFile))
    {
      IFile tempFile = (IFile)obj;
      this$1.wsContainer = tempFile.getParent();
      this$1.wsFilenameText.setText(tempFile.getName());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;

class ExportProjectSetLocationPage$2
  implements IDoubleClickListener
{
  final ExportProjectSetLocationPage.WorkspaceDialog this$1;
  
  ExportProjectSetLocationPage$2(ExportProjectSetLocationPage.WorkspaceDialog paramWorkspaceDialog)
  {
    this$1 = paramWorkspaceDialog;
  }
  
  public void doubleClick(DoubleClickEvent event)
  {
    ISelection s = event.getSelection();
    if ((s instanceof IStructuredSelection))
    {
      Object item = ((IStructuredSelection)s).getFirstElement();
      if (this$1.wsTreeViewer.getExpandedState(item)) {
        this$1.wsTreeViewer.collapseToLevel(item, 1);
      } else {
        this$1.wsTreeViewer.expandToLevel(item, 1);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.team.internal.ui.TeamUIMessages;

class ExportProjectSetLocationPage$3
  implements ModifyListener
{
  final ExportProjectSetLocationPage.WorkspaceDialog this$1;
  
  ExportProjectSetLocationPage$3(ExportProjectSetLocationPage.WorkspaceDialog paramWorkspaceDialog)
  {
    this$1 = paramWorkspaceDialog;
  }
  
  public void modifyText(ModifyEvent e)
  {
    String patchName = this$1.wsFilenameText.getText();
    if (patchName.trim().equals(""))
    {
      ExportProjectSetLocationPage.WorkspaceDialog.access$0(this$1).setEnabled(false);
      this$1.setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogErrorNoFilename);
    }
    else if (!ResourcesPlugin.getWorkspace().validateName(patchName, 1).isOK())
    {
      ExportProjectSetLocationPage.WorkspaceDialog.access$0(this$1).setEnabled(false);
      this$1.setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogErrorFilenameSegments);
    }
    else
    {
      ExportProjectSetLocationPage.WorkspaceDialog.access$0(this$1).setEnabled(true);
      this$1.setErrorMessage(null);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetLocationPage$4
  implements Listener
{
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$4(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
  }
  
  public void handleEvent(Event event)
  {
    ExportProjectSetLocationPage.access$0(this$0, true);
    this$0.file = this$0.fileCombo.getText();
    ExportProjectSetLocationPage.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetLocationPage$5
  implements Listener
{
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$5(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
  }
  
  public void handleEvent(Event event)
  {
    this$0.file = this$0.fileCombo.getText();
    ExportProjectSetLocationPage.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.team.internal.ui.TeamUIMessages;

class ExportProjectSetLocationPage$6
  implements Listener
{
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$6(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
  }
  
  public void handleEvent(Event event)
  {
    if (!this$0.isSaveToFileSystem()) {
      ExportProjectSetLocationPage.access$0(this$0, true);
    }
    FileDialog d = new FileDialog(this$0.getShell(), 8192);
    d.setFilterExtensions(new String[] { "*.psf" });
    d.setFilterNames(new String[] { TeamUIMessages.ExportProjectSetMainPage_Project_Set_Files_3 });
    d.setFileName(TeamUIMessages.ExportProjectSetMainPage_default);
    String fileName = this$0.getFileName();
    if (fileName != null)
    {
      int separator = fileName.lastIndexOf(System.getProperty("file.separator").charAt(0));
      if (separator != -1) {
        fileName = fileName.substring(0, separator);
      }
    }
    d.setFilterPath(fileName);
    String f = d.open();
    if (f != null)
    {
      this$0.fileCombo.setText(f);
      this$0.file = f;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetLocationPage$7
  implements Listener
{
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$7(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
  }
  
  public void handleEvent(Event event)
  {
    ExportProjectSetLocationPage.access$0(this$0, false);
    ExportProjectSetLocationPage.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.7
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetLocationPage$8
  implements Listener
{
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$8(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
  }
  
  public void handleEvent(Event event)
  {
    this$0.file = this$0.workspaceFile.getLocation().toString();
    ExportProjectSetLocationPage.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.8
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetLocationPage$9
  implements Listener
{
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$9(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
  }
  
  public void handleEvent(Event event)
  {
    if (this$0.isSaveToFileSystem()) {
      ExportProjectSetLocationPage.access$0(this$0, false);
    }
    ExportProjectSetLocationPage.WorkspaceDialog d = new ExportProjectSetLocationPage.WorkspaceDialog(this$0, this$0.getShell());
    d.open();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.9
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;

class ExportProjectSetLocationPage$LocationPageContentProvider
  extends BaseWorkbenchContentProvider
{
  boolean showClosedProjects;
  final ExportProjectSetLocationPage this$0;
  
  ExportProjectSetLocationPage$LocationPageContentProvider(ExportProjectSetLocationPage paramExportProjectSetLocationPage)
  {
    this$0 = paramExportProjectSetLocationPage;
    
    showClosedProjects = false;
  }
  
  public Object[] getChildren(Object element)
  {
    if ((element instanceof IWorkspace))
    {
      IProject[] allProjects = ((IWorkspace)element).getRoot().getProjects();
      if (showClosedProjects) {
        return allProjects;
      }
      ArrayList accessibleProjects = new ArrayList();
      for (int i = 0; i < allProjects.length; i++) {
        if (allProjects[i].isOpen()) {
          accessibleProjects.add(allProjects[i]);
        }
      }
      return accessibleProjects.toArray();
    }
    return super.getChildren(element);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.LocationPageContentProvider
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
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.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.ui.model.WorkbenchLabelProvider;

class ExportProjectSetLocationPage$WorkspaceDialog
  extends TitleAreaDialog
{
  protected TreeViewer wsTreeViewer;
  protected Text wsFilenameText;
  protected IContainer wsContainer;
  protected Image dlgTitleImage;
  private Button okButton;
  final ExportProjectSetLocationPage this$0;
  
  public ExportProjectSetLocationPage$WorkspaceDialog(ExportProjectSetLocationPage paramExportProjectSetLocationPage, Shell shell)
  {
    super(shell);
    this$0 = paramExportProjectSetLocationPage;
  }
  
  protected Control createContents(Composite parent)
  {
    Control control = super.createContents(parent);
    setTitle(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogTitle);
    setMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogTitleMessage);
    
    return control;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    
    GridLayout layout = new GridLayout();
    numColumns = 1;
    composite.setLayout(layout);
    GridData data = new GridData(4, 4, true, false);
    composite.setLayoutData(data);
    
    getShell().setText(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogMessage);
    
    wsTreeViewer = new TreeViewer(composite, 2048);
    GridData gd = new GridData(4, 4, true, true);
    widthHint = 550;
    heightHint = 250;
    wsTreeViewer.getTree().setLayoutData(gd);
    
    wsTreeViewer.setContentProvider(new ExportProjectSetLocationPage.LocationPageContentProvider(this$0));
    wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
    wsTreeViewer.setInput(ResourcesPlugin.getWorkspace());
    
    Composite group = new Composite(composite, 0);
    layout = new GridLayout(2, false);
    marginWidth = 0;
    group.setLayout(layout);
    group.setLayoutData(new GridData(4, 4, true, false));
    
    Label label = new Label(group, 0);
    label.setLayoutData(new GridData());
    label.setText(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogFilename);
    
    wsFilenameText = new Text(group, 2048);
    wsFilenameText.setLayoutData(new GridData(4, 128, true, false));
    wsFilenameText.setText("projectSet.psf");
    
    setupListeners();
    
    return parent;
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    super.createButtonsForButtonBar(parent);
    okButton = getButton(0);
  }
  
  protected void okPressed()
  {
    if (wsContainer == null) {
      getSelectedContainer();
    }
    this$0.workspaceFile = wsContainer.getFile(new Path(wsFilenameText.getText()));
    if (this$0.workspaceFile != null) {
      this$0.workspaceText.setText(this$0.workspaceFile.getFullPath().toString());
    }
    super.okPressed();
  }
  
  private void getSelectedContainer()
  {
    Object obj = ((IStructuredSelection)wsTreeViewer.getSelection()).getFirstElement();
    if ((obj instanceof IContainer)) {
      wsContainer = ((IContainer)obj);
    } else if ((obj instanceof IFile)) {
      wsContainer = ((IFile)obj).getParent();
    }
  }
  
  protected void cancelPressed()
  {
    getSelectedContainer();
    super.cancelPressed();
  }
  
  public boolean close()
  {
    return super.close();
  }
  
  void setupListeners()
  {
    wsTreeViewer.addSelectionChangedListener(new ExportProjectSetLocationPage.1(this));
    
    wsTreeViewer.addDoubleClickListener(new ExportProjectSetLocationPage.2(this));
    
    wsFilenameText.addModifyListener(new ExportProjectSetLocationPage.3(this));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage.WorkspaceDialog
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import java.io.File;
import java.util.ArrayList;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;

public class ExportProjectSetLocationPage
  extends TeamWizardPage
{
  Combo fileCombo;
  protected IFile workspaceFile;
  protected String file = "";
  Button browseButton;
  private boolean saveToFileSystem;
  private Button fileRadio;
  private Button workspaceRadio;
  protected Text workspaceText;
  
  public ExportProjectSetLocationPage(String pageName, String title, ImageDescriptor titleImage)
  {
    super(pageName, title, titleImage);
    setDescription(TeamUIMessages.ExportProjectSetMainPage_description);
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = createComposite(parent, 1);
    initializeDialogUnits(composite);
    
    Group locationGroup = new Group(composite, 0);
    GridLayout layout = new GridLayout();
    locationGroup.setLayout(layout);
    GridData data = new GridData(768);
    locationGroup.setLayoutData(data);
    locationGroup.setText(TeamUIMessages.ExportProjectSetMainPage_Project_Set_File_Name__3);
    
    createExportToFile(locationGroup);
    
    createExportToWorkspace(locationGroup);
    
    saveToFileSystem = true;
    
    setControl(composite);
    updateEnablement();
    Dialog.applyDialogFont(parent);
  }
  
  private void createExportToFile(Composite composite)
  {
    fileRadio = new Button(composite, 16);
    fileRadio.setText(TeamUIMessages.ExportProjectSetMainPage_FileButton);
    fileRadio.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        saveToFileSystem = true;
        file = fileCombo.getText();
        ExportProjectSetLocationPage.this.updateEnablement();
      }
    });
    Composite inner = new Composite(composite, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginWidth = 0;
    inner.setLayout(layout);
    GridData data = new GridData(4, 4, true, false);
    inner.setLayoutData(data);
    
    fileCombo = createDropDownCombo(inner);
    file = PsfFilenameStore.getInstance().getSuggestedDefault();
    fileCombo.setItems(PsfFilenameStore.getInstance().getHistory());
    fileCombo.setText(file);
    fileCombo.addListener(24, new Listener()
    {
      public void handleEvent(Event event)
      {
        file = fileCombo.getText();
        ExportProjectSetLocationPage.this.updateEnablement();
      }
    });
    browseButton = new Button(inner, 8);
    browseButton.setText(TeamUIMessages.ExportProjectSetMainPage_Browse_4);
    data = new GridData();
    horizontalAlignment = 4;
    int widthHint = convertHorizontalDLUsToPixels(61);
    widthHint = Math.max(widthHint, browseButton.computeSize(-1, -1, true).x);
    browseButton.setLayoutData(data);
    browseButton.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        if (!isSaveToFileSystem()) {
          saveToFileSystem = true;
        }
        FileDialog d = new FileDialog(getShell(), 8192);
        d.setFilterExtensions(new String[] { "*.psf" });
        d.setFilterNames(new String[] { TeamUIMessages.ExportProjectSetMainPage_Project_Set_Files_3 });
        d.setFileName(TeamUIMessages.ExportProjectSetMainPage_default);
        String fileName = getFileName();
        if (fileName != null)
        {
          int separator = fileName.lastIndexOf(System.getProperty("file.separator").charAt(0));
          if (separator != -1) {
            fileName = fileName.substring(0, separator);
          }
        }
        d.setFilterPath(fileName);
        String f = d.open();
        if (f != null)
        {
          fileCombo.setText(f);
          file = f;
        }
      }
    });
  }
  
  private void createExportToWorkspace(Composite composite)
  {
    workspaceRadio = new Button(composite, 16);
    workspaceRadio.setText(TeamUIMessages.ExportProjectSetMainPage_WorkspaceButton);
    workspaceRadio.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        saveToFileSystem = false;
        ExportProjectSetLocationPage.this.updateEnablement();
      }
    });
    Composite nameGroup = new Composite(composite, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginWidth = 0;
    nameGroup.setLayout(layout);
    GridData data = new GridData(4, 4, true, false);
    nameGroup.setLayoutData(data);
    
    workspaceText = createTextField(nameGroup);
    workspaceText.setEditable(false);
    workspaceText.addListener(24, new Listener()
    {
      public void handleEvent(Event event)
      {
        file = workspaceFile.getLocation().toString();
        ExportProjectSetLocationPage.this.updateEnablement();
      }
    });
    Button wsBrowseButton = new Button(nameGroup, 8);
    GridData gd = new GridData();
    horizontalAlignment = 4;
    int widthHint = convertHorizontalDLUsToPixels(61);
    widthHint = Math.max(widthHint, computeSize-1-1x);
    wsBrowseButton.setLayoutData(gd);
    wsBrowseButton.setText(TeamUIMessages.ExportProjectSetMainPage_Browse);
    wsBrowseButton.addListener(13, new Listener()
    {
      public void handleEvent(Event event)
      {
        if (isSaveToFileSystem()) {
          saveToFileSystem = false;
        }
        ExportProjectSetLocationPage.WorkspaceDialog d = new ExportProjectSetLocationPage.WorkspaceDialog(ExportProjectSetLocationPage.this, getShell());
        d.open();
      }
    });
  }
  
  private void updateEnablement()
  {
    fileRadio.setSelection(saveToFileSystem);
    workspaceRadio.setSelection(!saveToFileSystem);
    boolean complete;
    boolean complete;
    if (file.length() == 0)
    {
      setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_specifyFile);
      complete = false;
    }
    else
    {
      File f = new File(file);
      boolean complete;
      if (f.isDirectory())
      {
        setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_You_have_specified_a_folder_5);
        complete = false;
      }
      else
      {
        boolean complete;
        if ((!isSaveToFileSystem()) && (workspaceFile == null))
        {
          setErrorMessage(TeamUIMessages.ExportProjectSetMainPage_specifyFile);
          complete = false;
        }
        else
        {
          complete = true;
        }
      }
    }
    if ((!isSaveToFileSystem()) && (workspaceFile != null)) {
      complete = true;
    }
    if (complete)
    {
      setErrorMessage(null);
      setDescription(TeamUIMessages.ExportProjectSetMainPage_description);
    }
    setPageComplete(complete);
  }
  
  public void setVisible(boolean visible)
  {
    super.setVisible(visible);
    if (visible) {
      fileCombo.setFocus();
    }
  }
  
  public boolean isSaveToFileSystem()
  {
    return saveToFileSystem;
  }
  
  public void refreshWorkspaceFile(IProgressMonitor monitor)
    throws CoreException
  {
    if (workspaceFile != null) {
      workspaceFile.refreshLocal(1, monitor);
    }
  }
  
  public String getFileName()
  {
    return file;
  }
  
  public void setFileName(String file)
  {
    if (file != null) {
      this.file = file;
    }
  }
  
  class WorkspaceDialog
    extends TitleAreaDialog
  {
    protected TreeViewer wsTreeViewer;
    protected Text wsFilenameText;
    protected IContainer wsContainer;
    protected Image dlgTitleImage;
    private Button okButton;
    
    public WorkspaceDialog(Shell shell)
    {
      super();
    }
    
    protected Control createContents(Composite parent)
    {
      Control control = super.createContents(parent);
      setTitle(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogTitle);
      setMessage(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogTitleMessage);
      
      return control;
    }
    
    protected Control createDialogArea(Composite parent)
    {
      Composite composite = (Composite)super.createDialogArea(parent);
      
      GridLayout layout = new GridLayout();
      numColumns = 1;
      composite.setLayout(layout);
      GridData data = new GridData(4, 4, true, false);
      composite.setLayoutData(data);
      
      getShell().setText(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogMessage);
      
      wsTreeViewer = new TreeViewer(composite, 2048);
      GridData gd = new GridData(4, 4, true, true);
      widthHint = 550;
      heightHint = 250;
      wsTreeViewer.getTree().setLayoutData(gd);
      
      wsTreeViewer.setContentProvider(new ExportProjectSetLocationPage.LocationPageContentProvider(ExportProjectSetLocationPage.this));
      wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
      wsTreeViewer.setInput(ResourcesPlugin.getWorkspace());
      
      Composite group = new Composite(composite, 0);
      layout = new GridLayout(2, false);
      marginWidth = 0;
      group.setLayout(layout);
      group.setLayoutData(new GridData(4, 4, true, false));
      
      Label label = new Label(group, 0);
      label.setLayoutData(new GridData());
      label.setText(TeamUIMessages.ExportProjectSetMainPage_WorkspaceDialogFilename);
      
      wsFilenameText = new Text(group, 2048);
      wsFilenameText.setLayoutData(new GridData(4, 128, true, false));
      wsFilenameText.setText("projectSet.psf");
      
      setupListeners();
      
      return parent;
    }
    
    protected void createButtonsForButtonBar(Composite parent)
    {
      super.createButtonsForButtonBar(parent);
      okButton = getButton(0);
    }
    
    protected void okPressed()
    {
      if (wsContainer == null) {
        getSelectedContainer();
      }
      workspaceFile = wsContainer.getFile(new Path(wsFilenameText.getText()));
      if (workspaceFile != null) {
        workspaceText.setText(workspaceFile.getFullPath().toString());
      }
      super.okPressed();
    }
    
    private void getSelectedContainer()
    {
      Object obj = ((IStructuredSelection)wsTreeViewer.getSelection()).getFirstElement();
      if ((obj instanceof IContainer)) {
        wsContainer = ((IContainer)obj);
      } else if ((obj instanceof IFile)) {
        wsContainer = ((IFile)obj).getParent();
      }
    }
    
    protected void cancelPressed()
    {
      getSelectedContainer();
      super.cancelPressed();
    }
    
    public boolean close()
    {
      return super.close();
    }
    
    void setupListeners()
    {
      wsTreeViewer.addSelectionChangedListener(new ExportProjectSetLocationPage.1(this));
      
      wsTreeViewer.addDoubleClickListener(new ExportProjectSetLocationPage.2(this));
      
      wsFilenameText.addModifyListener(new ExportProjectSetLocationPage.3(this));
    }
  }
  
  class LocationPageContentProvider
    extends BaseWorkbenchContentProvider
  {
    boolean showClosedProjects = false;
    
    LocationPageContentProvider() {}
    
    public Object[] getChildren(Object element)
    {
      if ((element instanceof IWorkspace))
      {
        IProject[] allProjects = ((IWorkspace)element).getRoot().getProjects();
        if (showClosedProjects) {
          return allProjects;
        }
        ArrayList accessibleProjects = new ArrayList();
        for (int i = 0; i < allProjects.length; i++) {
          if (allProjects[i].isOpen()) {
            accessibleProjects.add(allProjects[i]);
          }
        }
        return accessibleProjects.toArray();
      }
      return super.getChildren(element);
    }
  }
  
  public void validateEditWorkspaceFile(Shell shell)
    throws TeamException
  {
    if ((workspaceFile == null) || (!workspaceFile.exists()) || (!workspaceFile.isReadOnly())) {
      return;
    }
    IStatus status = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { workspaceFile }, shell);
    if (!status.isOK()) {
      throw new TeamException(status);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetLocationPage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import java.util.ArrayList;
import java.util.HashSet;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.ui.IWorkingSet;

class ExportProjectSetMainPage$1
  implements ICheckStateListener
{
  final ExportProjectSetMainPage.ProjectPage this$1;
  
  ExportProjectSetMainPage$1(ExportProjectSetMainPage.ProjectPage paramProjectPage)
  {
    this$1 = paramProjectPage;
  }
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    Object temp = event.getElement();
    if ((temp instanceof IProject))
    {
      IProject project = (IProject)event.getElement();
      if (event.getChecked())
      {
        this$1.selectedProjects.add(project);
        this$1.referenceCountProjects.add(project);
      }
      else
      {
        this$1.selectedProjects.remove(project);
        this$1.referenceCountProjects.remove(project);
      }
    }
    else if ((temp instanceof IWorkingSet))
    {
      IWorkingSet workingSet = (IWorkingSet)temp;
      if (event.getChecked())
      {
        IAdaptable[] elements = workingSet.getElements();
        for (int i = 0; i < elements.length; i++) {
          this$1.selectedProjects.add(elements[i]);
        }
      }
      else
      {
        IAdaptable[] elements = workingSet.getElements();
        for (int i = 0; i < elements.length; i++) {
          this$1.selectedProjects.remove(elements[i]);
        }
      }
    }
    ExportProjectSetMainPage.ProjectPage.access$0(this$1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetMainPage.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import java.util.HashSet;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetMainPage$2
  implements Listener
{
  final ExportProjectSetMainPage.ProjectPage this$1;
  
  ExportProjectSetMainPage$2(ExportProjectSetMainPage.ProjectPage paramProjectPage)
  {
    this$1 = paramProjectPage;
  }
  
  public void handleEvent(Event event)
  {
    ExportProjectSetMainPage.ProjectPage.access$1(this$1).setAllChecked(true);
    this$1.selectedProjects.removeAll(this$1.selectedProjects);
    Object[] checked = ExportProjectSetMainPage.ProjectPage.access$1(this$1).getCheckedElements();
    for (int i = 0; i < checked.length; i++) {
      this$1.selectedProjects.add(checked[i]);
    }
    ExportProjectSetMainPage.ProjectPage.access$0(this$1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetMainPage.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import java.util.HashSet;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class ExportProjectSetMainPage$3
  implements Listener
{
  final ExportProjectSetMainPage.ProjectPage this$1;
  
  ExportProjectSetMainPage$3(ExportProjectSetMainPage.ProjectPage paramProjectPage)
  {
    this$1 = paramProjectPage;
  }
  
  public void handleEvent(Event event)
  {
    ExportProjectSetMainPage.ProjectPage.access$1(this$1).setAllChecked(false);
    this$1.selectedProjects.removeAll(this$1.selectedProjects);
    ExportProjectSetMainPage.ProjectPage.access$0(this$1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetMainPage.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.ui.IWorkingSet;

class ExportProjectSetMainPage$4
  implements ICheckStateListener
{
  final ExportProjectSetMainPage.WorkingSetPage this$1;
  
  ExportProjectSetMainPage$4(ExportProjectSetMainPage.WorkingSetPage paramWorkingSetPage)
  {
    this$1 = paramWorkingSetPage;
  }
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    Object temp = event.getElement();
    if ((temp instanceof IWorkingSet))
    {
      IWorkingSet workingSet = (IWorkingSet)temp;
      if (event.getChecked())
      {
        ExportProjectSetMainPage.WorkingSetPage.access$0(this$1, workingSet);
        
        ExportProjectSetMainPage.WorkingSetPage.access$1(this$1).setInput(this$1.selectedProjects);
      }
      else
      {
        ExportProjectSetMainPage.WorkingSetPage.access$2(this$1, workingSet);
        
        ExportProjectSetMainPage.WorkingSetPage.access$1(this$1).setInput(this$1.selectedProjects);
      }
    }
    ExportProjectSetMainPage.WorkingSetPage.access$3(this$1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.wizards.ExportProjectSetMainPage.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.wizards;

import java.util.ArrayList;
import java.u
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

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