org.eclipse.emf.exporter_2.6.0.v20120130-0943

calGenPackages)
          {
            EPackage ePackage = genPackage.getEcorePackage();
            String location = getEPackageExportInfo(ePackage).getArtifactLocation();
            if (location != null)
            {
              GenAnnotation genPackageAnnotation = genPackage.getGenAnnotation(getConverterGenAnnotationSource());
              if (genPackageAnnotation == null)
              {
                genPackageAnnotation = ExporterUtil.findOrCreateGenAnnotation(genPackage, getConverterGenAnnotationSource());
                changed = true;
              }
              URI uri = computeArtifactURI(location);
              if (genModelURI != null) {
                uri = uri.deresolve(genModelURI);
              }
              String stringURI = uri.toString();
              
              GenAnnotation uriAnnotation = genPackageAnnotation.getGenAnnotation(stringURI);
              if (uriAnnotation == null)
              {
                uriAnnotation = ExporterUtil.findOrCreateGenAnnotation(genPackageAnnotation, stringURI);
                if (!externalPackageToLocalURIMap.isEmpty()) {
                  uriAnnotation.getDetails().putAll(externalPackageToLocalURIMap);
                }
                changed = true;
              }
              else if (externalPackageToLocalURIMap.isEmpty())
              {
                if (!uriAnnotation.getDetails().isEmpty())
                {
                  uriAnnotation.getDetails().clear();
                  changed = true;
                }
              }
              else if (!externalPackageToLocalURIMap.equals(uriAnnotation.getDetails().map()))
              {
                uriAnnotation.getDetails().clear();
                uriAnnotation.getDetails().putAll(externalPackageToLocalURIMap);
                changed = true;
              }
            }
          }
        }
        return changed;
      }
      
      protected String getDefaultArtifactFileName(EPackage ePackage)
      {
        if ((ePackage.eResource() != null) && (ePackage.getESuperPackage() == null))
        {
          String fileName = ePackage.eResource().getURI().lastSegment();
          int lastIndex = fileName.lastIndexOf('.');
          if (lastIndex > 0) {
            return fileName.substring(0, lastIndex);
          }
        }
        return ConverterUtil.getQualifiedName(ePackage);
      }
      
      protected void printExportData(ExportData exportData)
      {
        System.out.println("\nExport Data =======================================");
        for (Map.Entry<GenPackage, URI> entry : genPackageToArtifactURI.entrySet())
        {
          GenPackage genPackage = (GenPackage)entry.getKey();
          URI artifactURI = (URI)entry.getValue();
          List<GenPackage> referencedGenPackages = (List)genPackageToReferencedGenPackages.get(genPackage);
          
          System.out.println("\nGenPackage: " + genPackage.getNSURI());
          System.out.println("Resource: " + genPackage.eResource().getURI());
          System.out.println("Artifact: " + artifactURI.toString());
          if (referencedGenPackages != null)
          {
            System.out.println("Referenced GenPackages:");
            for (GenPackage referencedGenPackage : referencedGenPackages)
            {
              System.out.println("\tGenPackage: " + referencedGenPackage.getNSURI());
              System.out.println("\tResource: " + referencedGenPackage.eResource().getURI());
            }
          }
        }
        if (!referencedGenPackagesToArtifactURI.isEmpty())
        {
          System.out.println("\n-Referenced GenPackages-----------------------------");
          for (Map.Entry<GenPackage, URI> entry : referencedGenPackagesToArtifactURI.entrySet())
          {
            GenPackage genPackage = (GenPackage)entry.getKey();
            URI artifactURI = (URI)entry.getValue();
            
            System.out.println("\nReferenced GenPackage: " + genPackage.getNSURI());
            System.out.println("Resource: " + genPackage.eResource().getURI());
            System.out.println("Artifact: " + artifactURI.toString());
          }
        }
        System.out.println("\n====================================================");
      }
      
      public static class ExportData
      {
        public Map<GenPackage, URI> genPackageToArtifactURI;
        public Map<GenPackage, List<GenPackage>> genPackageToReferencedGenPackages;
        public Map<GenPackage, URI> referencedGenPackagesToArtifactURI;
      }
    }

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ModelExporter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui;

import java.util.List;
import org.eclipse.emf.converter.ui.ModelConverterDescriptorSelectionPage;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ui.contribution.ModelExporterDescriptor;
import org.eclipse.emf.exporter.ui.contribution.ModelExporterManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;

public class EMFExportWizard$SelectionPage
  extends ModelConverterDescriptorSelectionPage
{
  public EMFExportWizard$SelectionPage(EMFExportWizard paramEMFExportWizard, String pageId, IWorkbench workbench, IStructuredSelection selection)
  {
    super(pageId, ModelExporterManager.INSTANCE, workbench, selection);
  }
  
  protected Object[] getTableInput()
  {
    return this$0.getModelExporterDescriptors().toArray();
  }
  
  protected String getSelectModelConverterLabel()
  {
    return ExporterPlugin.INSTANCE.getString("_UI_SelectModelExporters_label");
  }
  
  public void setModelExporterDescriptor(ModelExporterDescriptor modelExporterDescriptor)
  {
    setModelConverterDescriptor(modelExporterDescriptor);
  }
  
  public ModelExporterDescriptor getModelExporterDescriptor()
  {
    return (ModelExporterDescriptor)getModelConverterDescriptor();
  }
  
  protected void adjustModelConverterWizard(IWizard modelConverterWizard)
  {
    this$0.adjustModelExporterWizard((IWorkbenchWizard)modelConverterWizard, getModelExporterDescriptor());
  }
  
  protected String getNoModelConverterMessage()
  {
    return ExporterPlugin.INSTANCE.getString("_UI_NoModelExporters_error");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.EMFExportWizard.SelectionPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui;

import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.converter.ui.ModelConverterDescriptorSelectionPage;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ui.contribution.ModelExporterDescriptor;
import org.eclipse.emf.exporter.ui.contribution.ModelExporterManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;

public class EMFExportWizard
  extends Wizard
  implements IWorkbenchWizard
{
  protected IStructuredSelection selection;
  protected IWorkbench workbench;
  protected IFile modelFile;
  protected ModelConverterDescriptorSelectionPage selectionPage;
  
  public class SelectionPage
    extends ModelConverterDescriptorSelectionPage
  {
    public SelectionPage(String pageId, IWorkbench workbench, IStructuredSelection selection)
    {
      super(ModelExporterManager.INSTANCE, workbench, selection);
    }
    
    protected Object[] getTableInput()
    {
      return getModelExporterDescriptors().toArray();
    }
    
    protected String getSelectModelConverterLabel()
    {
      return ExporterPlugin.INSTANCE.getString("_UI_SelectModelExporters_label");
    }
    
    public void setModelExporterDescriptor(ModelExporterDescriptor modelExporterDescriptor)
    {
      setModelConverterDescriptor(modelExporterDescriptor);
    }
    
    public ModelExporterDescriptor getModelExporterDescriptor()
    {
      return (ModelExporterDescriptor)getModelConverterDescriptor();
    }
    
    protected void adjustModelConverterWizard(IWizard modelConverterWizard)
    {
      adjustModelExporterWizard((IWorkbenchWizard)modelConverterWizard, getModelExporterDescriptor());
    }
    
    protected String getNoModelConverterMessage()
    {
      return ExporterPlugin.INSTANCE.getString("_UI_NoModelExporters_error");
    }
  }
  
  public EMFExportWizard()
  {
    setForcePreviousAndNextButtons(true);
    setWindowTitle(ExporterPlugin.INSTANCE.getString("_UI_ExportModelWizard_title"));
  }
  
  public EMFExportWizard(IFile modelFile)
  {
    this();
    this.modelFile = modelFile;
  }
  
  public void dispose()
  {
    selection = null;
    workbench = null;
    if (selectionPage != null)
    {
      selectionPage.clearCache();
      selectionPage = null;
    }
    super.dispose();
  }
  
  protected ImageDescriptor getDefaultImageDescriptor()
  {
    return ExtendedImageRegistry.INSTANCE.getImageDescriptor(ExporterPlugin.INSTANCE.getImage("ExportModel"));
  }
  
  public void addPages()
  {
    selectionPage = new SelectionPage("ModelExporterDescriptorSelectionPage", workbench, selection);
    selectionPage.setTitle(ExporterPlugin.INSTANCE.getString("_UI_SelectModelExporters_title"));
    selectionPage.setModeConverterWizardDefaultImageDescriptor(getDefaultImageDescriptor());
    addPage(selectionPage);
  }
  
  public void init(IWorkbench workbench, IStructuredSelection selection)
  {
    this.workbench = workbench;
    this.selection = selection;
    init();
  }
  
  protected void init()
  {
    setDefaultPageImageDescriptor(getDefaultImageDescriptor());
  }
  
  protected List<ModelExporterDescriptor> getModelExporterDescriptors()
  {
    return ModelExporterManager.INSTANCE.getModelConverterDescriptors();
  }
  
  protected void adjustModelExporterWizard(IWorkbenchWizard workbenchWizard, ModelExporterDescriptor modelExporterDescriptor) {}
  
  public boolean canFinish()
  {
    return false;
  }
  
  public boolean performFinish()
  {
    selectionPage.performFinish();
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.EMFExportWizard
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui;

import org.eclipse.core.resources.IFile;
import org.eclipse.emf.converter.ui.OpenWizardActionDelegate;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbench;

public class GenModelExportActionDelegate
  extends OpenWizardActionDelegate
{
  protected IWizard createWizard(IWorkbench workbench, Shell shell, IFile file)
  {
    EMFExportWizard wizard = new EMFExportWizard(file);
    wizard.init(workbench, new StructuredSelection(file));
    return wizard;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.GenModelExportActionDelegate
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution;

import org.eclipse.emf.converter.ui.contribution.ModelConverterDescriptor;
import org.eclipse.ui.IWorkbenchWizard;

public abstract interface ModelExporterDescriptor
  extends ModelConverterDescriptor
{
  public abstract IWorkbenchWizard createWizard();
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.ModelExporterDescriptor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution;

import org.eclipse.emf.converter.ui.contribution.ModelConverterManager.ModelConverterDescriptorImpl;
import org.eclipse.ui.IWorkbenchWizard;

public class ModelExporterManager$ModelExporterDescriptorImpl
  extends ModelConverterManager.ModelConverterDescriptorImpl
  implements ModelExporterDescriptor
{
  public IWorkbenchWizard createWizard()
  {
    Object object = createExecutableExtension("wizard");
    return (object instanceof IWorkbenchWizard) ? (IWorkbenchWizard)object : null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.ModelExporterManager.ModelExporterDescriptorImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution;

import org.eclipse.emf.converter.ui.contribution.ModelConverterManager.ModelConverterDescriptorWizardNode;
import org.eclipse.jface.wizard.IWizard;

public class ModelExporterManager$ModelExporterDescriptorWizardNode
  extends ModelConverterManager.ModelConverterDescriptorWizardNode
{
  public ModelExporterManager$ModelExporterDescriptorWizardNode(ModelExporterDescriptor descriptor)
  {
    super(descriptor);
  }
  
  protected IWizard createWizard()
  {
    return ((ModelExporterDescriptor)descriptor).createWizard();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.ModelExporterManager.ModelExporterDescriptorWizardNode
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution;

import org.eclipse.emf.converter.ui.contribution.ModelConverterManager;
import org.eclipse.emf.converter.ui.contribution.ModelConverterManager.ModelConverterDescriptorImpl;
import org.eclipse.emf.converter.ui.contribution.ModelConverterManager.ModelConverterDescriptorWizardNode;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.IWorkbenchWizard;

public class ModelExporterManager
  extends ModelConverterManager<ModelExporterDescriptor>
{
  public static final ModelExporterManager INSTANCE = new ModelExporterManager();
  
  public static class ModelExporterDescriptorImpl
    extends ModelConverterManager.ModelConverterDescriptorImpl
    implements ModelExporterDescriptor
  {
    public IWorkbenchWizard createWizard()
    {
      Object object = createExecutableExtension("wizard");
      return (object instanceof IWorkbenchWizard) ? (IWorkbenchWizard)object : null;
    }
  }
  
  public static class ModelExporterDescriptorWizardNode
    extends ModelConverterManager.ModelConverterDescriptorWizardNode
  {
    public ModelExporterDescriptorWizardNode(ModelExporterDescriptor descriptor)
    {
      super();
    }
    
    protected IWizard createWizard()
    {
      return ((ModelExporterDescriptor)descriptor).createWizard();
    }
  }
  
  protected String getPluginId()
  {
    return "org.eclipse.emf.exporter";
  }
  
  protected String getExtensionPointId()
  {
    return "modelExporterDescriptors";
  }
  
  protected String getElementName()
  {
    return "modelExporterDescriptor";
  }
  
  protected ModelConverterManager.ModelConverterDescriptorImpl createModelConverterDescriptorImpl()
  {
    return new ModelExporterDescriptorImpl();
  }
  
  protected ModelConverterManager.ModelConverterDescriptorWizardNode createModelConverterDescriptorWizardNode(ModelExporterDescriptor descriptor)
  {
    return new ModelExporterDescriptorWizardNode(descriptor);
  }
  
  public ModelExporterDescriptor getModelExporterDescriptor(String id)
  {
    return (ModelExporterDescriptor)getModelConverterDescriptor(id);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.ModelExporterManager
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.jface.wizard.IWizardPage;

public abstract interface IModelExporterPage
  extends IWizardPage
{
  public abstract ModelExporter getModelExporter();
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.IModelExporterPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import java.io.File;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.ui.CommonUIPlugin;
import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.converter.ui.contribution.base.ModelConverterURIPage;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.swt.widgets.DirectoryDialog;

public class ModelExporterDirectoryURIPage
  extends ModelConverterURIPage
  implements IModelExporterPage
{
  public ModelExporterDirectoryURIPage(ModelExporter modelExporter, String pageName)
  {
    super(modelExporter, pageName);
    setDescription(ExporterPlugin.INSTANCE.getString("_UI_ArtifactDirectory_description"));
  }
  
  public ModelExporter getModelExporter()
  {
    return (ModelExporter)getModelConverter();
  }
  
  public boolean isPageComplete()
  {
    return (super.isPageComplete()) && (getModelExporter().getDirectoryURI() != null);
  }
  
  protected String getURITextLabel()
  {
    return ExporterPlugin.INSTANCE.getString("_UI_ArtifactDirectoryURI_label");
  }
  
  protected String getURITextInitialValue()
  {
    URI uri = getModelExporter().getDirectoryURI();
    return uri == null ? super.getURITextInitialValue() : uri.toString();
  }
  
  protected void uriTextModified(String text)
  {
    if (text.length() == 0)
    {
      setErrorMessage(ExporterPlugin.INSTANCE.getString("_UI_DirectoryURI_error"));
    }
    else
    {
      Diagnostic diagnostic = getModelExporter().validateDirectoryURI(text);
      if (diagnostic.getSeverity() == 0)
      {
        getModelExporter().setDirectoryURI(text);
        if (getErrorMessage() != null) {
          handleDiagnostic(diagnostic);
        }
      }
      else
      {
        getModelExporter().setDirectoryURI(null);
        if (getErrorMessage() == null) {
          handleDiagnostic(diagnostic);
        }
      }
    }
  }
  
  protected boolean browseFileSystem()
  {
    DirectoryDialog directoryDialog = new DirectoryDialog(getShell(), 0);
    directoryDialog.setText(CommonUIPlugin.INSTANCE.getString("_UI_FolderSelection_title"));
    URI uri = getModelExporter().getDirectoryURI();
    if (uri != null) {
      directoryDialog.setFilterPath(uri.toFileString());
    }
    String directory = directoryDialog.open();
    if (directory != null)
    {
      setDirectory(directory, false);
      return true;
    }
    return false;
  }
  
  protected boolean browseWorkspace()
  {
    IResource initialFolderResource = null;
    URI uri = getModelExporter().getDirectoryURI();
    if (uri != null) {
      if (uri.isPlatformResource())
      {
        String initialFolder = uri.toPlatformString(true);
        initialFolderResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(initialFolder));
      }
    }
    IContainer[] containers = WorkspaceResourceDialog.openFolderSelection(
      getShell(), 
      null, null, 
      false, new Object[] { initialFolderResource }, null);
    if (containers.length == 1)
    {
      setDirectory(containers[0].getFullPath().toString(), true);
      return true;
    }
    return false;
  }
  
  protected void setDirectory(String directory, boolean platformURI)
  {
    if (!directory.endsWith(File.separator)) {
      directory = directory + File.separator;
    }
    if (platformURI) {
      getModelExporter().setDirectoryURI(URI.createPlatformResourceURI(directory, true));
    } else {
      getModelExporter().setDirectoryURI(URI.createFileURI(directory));
    }
    setURIText(getModelExporter().getDirectoryURI().toString());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.ModelExporterDirectoryURIPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import org.eclipse.emf.converter.ui.contribution.base.ModelConverterPage;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ExporterPlugin.Implementation;
import org.eclipse.emf.exporter.ModelExporter;
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.Event;

public class ModelExporterOptionsPage
  extends ModelConverterPage
  implements IModelExporterPage
{
  protected Button saveEPackageURIButton;
  protected Button saveExporterButton;
  
  public ModelExporterOptionsPage(ModelExporter modelExporter, String pageName)
  {
    super(modelExporter, pageName);
    setPageComplete(true);
    setMessage(ExporterPlugin.getPlugin().getString("_UI_SaveWizardSettings_description"));
  }
  
  public ModelExporter getModelExporter()
  {
    return (ModelExporter)getModelConverter();
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    verticalSpacing = 12;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(1808));
    
    createSaveSettingsControl(composite);
    
    setControl(composite);
  }
  
  protected void createSaveSettingsControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayoutData(new GridData(768));
    
    GridLayout layout = new GridLayout();
    marginLeft = -5;
    marginRight = -5;
    marginTop = -5;
    marginBottom = -5;
    composite.setLayout(layout);
    
    saveEPackageURIButton = new Button(composite, 32);
    saveEPackageURIButton.setLayoutData(new GridData(768));
    saveEPackageURIButton.setText(ExporterPlugin.INSTANCE.getString("_UI_SavePackageURI_label"));
    saveEPackageURIButton.addListener(13, this);
    
    saveExporterButton = new Button(composite, 32);
    saveExporterButton.setLayoutData(new GridData(768));
    saveExporterButton.setText(ExporterPlugin.INSTANCE.getString("_UI_SaveWizardSettings_label"));
    saveExporterButton.addListener(13, this);
  }
  
  protected void pageActivated(boolean firstTime, int cause)
  {
    if (firstTime)
    {
      saveEPackageURIButton.setSelection(getModelExporter().isSaveEPackageArtifactURI());
      saveExporterButton.setSelection(getModelExporter().isSaveExporter());
    }
  }
  
  protected void doHandleEvent(Event event)
  {
    if (type == 13)
    {
      if (widget == saveEPackageURIButton) {
        getModelExporter().setSaveEPackageArtifactURI(saveEPackageURIButton.getSelection());
      }
      if (widget == saveExporterButton) {
        getModelExporter().setSaveExporter(saveExporterButton.getSelection());
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.ModelExporterOptionsPage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.converter.util.ConverterUIUtil.TreeCheckStateManager;
import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.emf.exporter.ModelExporter.ReferencedGenPackageExportInfo;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

class ModelExporterPackagePage$1
  extends ConverterUIUtil.TreeCheckStateManager
{
  ModelExporterPackagePage$1(ModelExporterPackagePage paramModelExporterPackagePage, Tree $anonymous0)
  {
    super($anonymous0);
  }
  
  protected void setCheck(TreeItem item, boolean check)
  {
    Object data = item.getData();
    if ((!(data instanceof GenPackage)) || 
      (this$0.getModelExporter().getReferencedGenPackageExportInfo((GenPackage)data).isValidReference())) {
      super.setCheck(item, check);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.ModelExporterPackagePage.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.emf.exporter.ModelExporter.ReferencedGenPackageExportInfo;
import org.eclipse.swt.graphics.Image;

class ModelExporterPackagePage$2
  extends AdapterFactoryLabelProvider
{
  ModelExporterPackagePage$2(ModelExporterPackagePage paramModelExporterPackagePage, AdapterFactory $anonymous0)
  {
    super($anonymous0);
  }
  
  public String getColumnText(Object object, int columnIndex)
  {
    if (columnIndex == 0) {
      return ModelExporterPackagePage.access$1(this$0, object, super.getColumnText(object, 0));
    }
    if ((object instanceof GenPackage))
    {
      GenPackage genPackage = (GenPackage)object;
      ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = this$0.getModelExporter().getReferencedGenPackageExportInfo(genPackage);
      if (genPackageInfo.isValidReference()) {
        return this$0.getArtifactText(genPackageInfo.getModelExporterID(), genPackageInfo.getArtifactURI());
      }
      return ExporterPlugin.INSTANCE.getString("_UI_NotAvailable_text");
    }
    return "";
  }
  
  public Image getColumnImage(Object object, int columnIndex)
  {
    return columnIndex == 0 ? super.getColumnImage(object, columnIndex) : null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.ModelExporterPackagePage.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.emf.exporter.ModelExporter.ReferencedGenPackageExportInfo;
import org.eclipse.emf.exporter.util.ExporterUIUtil.TreeEditorHelper;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;

public class ModelExporterPackagePage$ReferencedGenPackageTreeEditorHelper
  extends ExporterUIUtil.TreeEditorHelper
{
  public ModelExporterPackagePage$ReferencedGenPackageTreeEditorHelper(ModelExporterPackagePage paramModelExporterPackagePage, Tree tree)
  {
    super(tree);
  }
  
  public void handleEvent(Event event)
  {
    if ((widget instanceof CCombo)) {
      comboSelected(event);
    } else {
      super.handleEvent(event);
    }
  }
  
  protected void comboSelected(Event event)
  {
    CCombo combo = (CCombo)widget;
    TreeItem treeItem = ((TreeEditor)compositeEditor).getItem();
    String text = combo.getItem(combo.getSelectionIndex());
    treeItem.setText(getColumn(), text);
    
    boolean validate = true;
    Object[] itemData = (Object[])combo.getData(text);
    if (itemData != null)
    {
      String exporterID = (String)itemData[0];
      URI artifactURI = (URI)itemData[1];
      
      GenPackage genPackage = (GenPackage)combo.getData();
      ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = this$0.getModelExporter().getReferencedGenPackageExportInfo(genPackage);
      genPackageInfo.setModelExporterID(exporterID);
      genPackageInfo.setArtifactURI(artifactURI);
      if (treeItem.getChecked() != (artifactURI != null))
      {
        this$0.referencedGenModelsCheckboxTreeViewerCheckStateChanged(null);
        validate = false;
      }
    }
    if (validate)
    {
      this$0.validate();
      ModelExporterPackagePage.access$0(this$0).updateButtons();
    }
  }
  
  protected Control createEditorControl(Widget item)
  {
    TreeItem treeItem = (TreeItem)item;
    if (treeItem != null)
    {
      Object data = treeItem.getData();
      if ((data instanceof GenPackage))
      {
        GenPackage genPackage = (GenPackage)data;
        ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = this$0.getModelExporter().getReferencedGenPackageExportInfo(genPackage);
        if (genPackageInfo.isValidReference())
        {
          CCombo combo = new CCombo(treeItem.getParent(), 8388616);
          combo.addListener(13, this);
          initializeCombo(combo, genPackage);
          return combo;
        }
      }
    }
    return null;
  }
  
  protected void initializeCombo(CCombo combo, GenPackage genPackage)
  {
    combo.setData(genPackage);
    String exporterID = this$0.getModelExporter().getID();
    for (URI uri : this$0.getModelExporter().getArtifactURIs(genPackage))
    {
      String item = this$0.getArtifactText(exporterID, uri);
      combo.setData(item, new Object[] { exporterID, uri });
      combo.add(item);
    }
    ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = this$0.getModelExporter().getReferencedGenPackageExportInfo(genPackage);
    if (genPackageInfo.getArtifactURI() != null) {
      combo.setText(this$0.getArtifactText(genPackageInfo.getModelExporterID(), genPackageInfo.getArtifactURI()));
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.emf.exporter.ui.contribution.base.ModelExporterPackagePage.ReferencedGenPackageTreeEditorHelper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.emf.exporter.ui.contribution.base;

import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.converter.ui.contribution.base.ModelConverterPackagePage;
import org.eclipse.emf.converter.util.ConverterUIUtil.TreeCheckStateManager;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.emf.exporter.ExporterPlugin;
import org.eclipse.emf.exporter.ModelExporter;
import org.eclipse.emf.exporter.ModelExporter.EPackageExportInfo;
import org.eclipse.emf.exporter.ModelExporter.ReferencedGenPackageExportInfo;
import org.eclipse.emf.exporter.ui.contribution.ModelExporterDescriptor;
import org.eclipse.emf.exporter.ui.contribution.ModelExporterManager;
import org.eclipse.emf.exporter.util.ExporterUIUtil.TreeEditorHelper;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;

public class ModelExporterPackagePage
  extends ModelConverterPackagePage
  implements IModelExporterPage
{
  public class ReferencedGenPackageTreeEditorHelper
    extends ExporterUIUtil.TreeEditorHelper
  {
    public ReferencedGenPackageTreeEditorHelper(Tree tree)
    {
      super();
    }
    
    public void handleEvent(Event event)
    {
      if ((widget instanceof CCombo)) {
        comboSelected(event);
      } else {
        super.handleEvent(event);
      }
    }
    
    protected void comboSelected(Event event)
    {
      CCombo combo = (CCombo)widget;
      TreeItem treeItem = ((TreeEditor)compositeEditor).getItem();
      String text = combo.getItem(combo.getSelectionIndex());
      treeItem.setText(getColumn(), text);
      
      boolean validate = true;
      Object[] itemData = (Object[])combo.getData(text);
      if (itemData != null)
      {
        String exporterID = (String)itemData[0];
        URI artifactURI = (URI)itemData[1];
        
        GenPackage genPackage = (GenPackage)combo.getData();
        ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = getModelExporter().getReferencedGenPackageExportInfo(genPackage);
        genPackageInfo.setModelExporterID(exporterID);
        genPackageInfo.setArtifactURI(artifactURI);
        if (treeItem.getChecked() != (artifactURI != null))
        {
          referencedGenModelsCheckboxTreeViewerCheckStateChanged(null);
          validate = false;
        }
      }
      if (validate)
      {
        validate();
        getContainer().updateButtons();
      }
    }
    
    protected Control createEditorControl(Widget item)
    {
      TreeItem treeItem = (TreeItem)item;
      if (treeItem != null)
      {
        Object data = treeItem.getData();
        if ((data instanceof GenPackage))
        {
          GenPackage genPackage = (GenPackage)data;
          ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = getModelExporter().getReferencedGenPackageExportInfo(genPackage);
          if (genPackageInfo.isValidReference())
          {
            CCombo combo = new CCombo(treeItem.getParent(), 8388616);
            combo.addListener(13, this);
            initializeCombo(combo, genPackage);
            return combo;
          }
        }
      }
      return null;
    }
    
    protected void initializeCombo(CCombo combo, GenPackage genPackage)
    {
      combo.setData(genPackage);
      String exporterID = getModelExporter().getID();
      for (URI uri : getModelExporter().getArtifactURIs(genPackage))
      {
        String item = getArtifactText(exporterID, uri);
        combo.setData(item, new Object[] { exporterID, uri });
        combo.add(item);
      }
      ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = getModelExporter().getReferencedGenPackageExportInfo(genPackage);
      if (genPackageInfo.getArtifactURI() != null) {
        combo.setText(getArtifactText(genPackageInfo.getModelExporterID(), genPackageInfo.getArtifactURI()));
      }
    }
  }
  
  public ModelExporterPackagePage(ModelExporter modelExporter, String pageName)
  {
    super(modelExporter, pageName);
    setDescription(ExporterPlugin.INSTANCE.getString("_UI_PackageSelection_description"));
  }
  
  public ModelExporter getModelExporter()
  {
    return (ModelExporter)getModelConverter();
  }
  
  protected void adjustEPackagesTableViewer(CheckboxTableViewer ePackagesTableViewer)
  {
    super.adjustEPackagesTableViewer(ePackagesTableViewer);
    createEPackagesTableEditor();
  }
  
  protected boolean validateEPackageData(EPackage ePackage, String data)
  {
    Diagnostic diagnostic = getModelExporter().checkEPackageArtifactLocation(data, getLabel(ePackage));
    handleDiagnostic(diagnostic);
    return diagnostic.getSeverity() == 0;
  }
  
  protected void setEPackageData(EPackage ePackage, String data)
  {
    ModelExporter.EPackageExportInfo ePackageInfo = getModelExporter().getEPackageExportInfo(ePackage);
    ePackageInfo.setArtifactLocation(data);
  }
  
  protected String getEPackageData(EPackage ePackage)
  {
    return getModelExporter().getEPackageExportInfo(ePackage).getArtifactLocation();
  }
  
  protected String getEPackageDataColumnLabel()
  {
    return ExporterPlugin.INSTANCE.getString("_UI_ArtifactName_label");
  }
  
  protected void addReferencedGenModelsTreeColumns(CheckboxTreeViewer referencedGenModelsTreeViewer)
  {
    Tree tree = referencedGenModelsTreeViewer.getTree();
    tree.setHeaderVisible(true);
    
    TreeColumn genObjectColumn = new TreeColumn(tree, 0);
    genObjectColumn.setText(ExporterPlugin.INSTANCE.getString("_UI_GenObjectsColumn_title"));
    genObjectColumn.setResizable(true);
    genObjectColumn.setWidth(250);
    
    TreeColumn artifactColumn = new TreeColumn(tree, 0);
    artifactColumn.setText(ExporterPlugin.INSTANCE.getString("_UI_ExporterAndArtifactColumn_title"));
    artifactColumn.setResizable(true);
    artifactColumn.setWidth(200);
    
    ReferencedGenPackageTreeEditorHelper treeEditorHelper = new ReferencedGenPackageTreeEditorHelper(tree);
    treeEditorHelper.setColumn(1);
  }
  
  protected void addReferencedGenModelsTreeCheckStateManager(Tree tree)
  {
    new ConverterUIUtil.TreeCheckStateManager(tree);
    {
      protected void setCheck(TreeItem item, boolean check)
      {
        Object data = item.getData();
        if ((!(data instanceof GenPackage)) || 
          (getModelExporter().getReferencedGenPackageExportInfo((GenPackage)data).isValidReference())) {
          super.setCheck(item, check);
        }
      }
    }
  }
  
  protected void referencedGenModelsCheckboxTreeViewerCheckStateChanged(CheckStateChangedEvent event)
  {
    if ((event != null) && (event.getChecked()))
    {
      Object element = event.getElement();
      if ((element instanceof GenPackage))
      {
        GenPackage genPackage = (GenPackage)element;
        ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = getModelExporter().getReferencedGenPackageExportInfo(genPackage);
        if (!genPackageInfo.isValidReference())
        {
          ((CheckboxTreeViewer)event.getSource()).setChecked(genPackage, false);
          return;
        }
      }
    }
    super.referencedGenModelsCheckboxTreeViewerCheckStateChanged(event);
  }
  
  protected boolean supportsNestedPackages()
  {
    return true;
  }
  
  protected ILabelProvider getReferencedGenModelsTreeViewerLabelProvider(AdapterFactory adapterFactory)
  {
    new AdapterFactoryLabelProvider(adapterFactory)
    {
      public String getColumnText(Object object, int columnIndex)
      {
        if (columnIndex == 0) {
          return getLabel(object, super.getColumnText(object, 0));
        }
        if ((object instanceof GenPackage))
        {
          GenPackage genPackage = (GenPackage)object;
          ModelExporter.ReferencedGenPackageExportInfo genPackageInfo = getModelExporter().getReferencedGenPackageExportInfo(genPackage);
          if (genPackageInfo.isValidReference()) {
            return getArtifactText(genPackageInfo.getModelExporterID(), genPackageInfo.getArtifactURI());
          }
          return ExporterPlugin.INSTANCE.getString("_UI_NotAvailable_text");
        }
        return "";
      }
      
      public Image getColumnImage(Object object, int columnIndex)
      {
        return columnIndex == 0 ? super.getColumnImage(object, columnIndex) : null;
      }
    };
  }
  
  protected String getArtifactText(String modelExporterId, URI artifactURI)
  {
    if (artifactURI != null)
    {
      String modelExporterLabel = artifactURI.toString();
      if (modelExporterId != null)
      {
        ModelExporterDescriptor modelExporterDescriptor = ModelExporterManager.INSTANCE.getModelExporterDescriptor(modelExporterId);
        modelExporterLabel = 
          (modelExporterDescriptor != null ? modelExporterDescriptor.getName() : modelExporterId) + 
          " - " + modelExporterLabel;
      }
      return modelExporterLabel;
    }
    return "";
  }
  
  protected void validate()
  {
    super.validate();
    if (getErrorMessage() == null)
    {
      List<EPackage> tableCheckedEPackages = getCheckedEPackages();
      for (EPackage ePackage : tableCheckedEPackages) {
        if (!validateEPackageData(ePackage, getModelExporter().getEPackageExportInfo(ePackage).getArtifactLocation())) {
          return;
        }
      }
      List<GenPackage> tableCheckedGenPackages = getCheckedReferencedGenPackages();
      for (GenPackage genPackage : tableCheckedGenPackages) {
        if (getMode
1 2 3

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