コード例 #1
0
 /** @generated */
 public void init(IWorkbench workbench, IStructuredSelection selection) {
   this.workbench = workbench;
   this.selection = selection;
   setWindowTitle(Messages.PinsCreationWizardTitle);
   setDefaultPageImageDescriptor(
       PinsDiagramEditorPlugin.getBundledImageDescriptor(
           "icons/wizban/NewPinsWizard.gif")); //$NON-NLS-1$
   setNeedsProgressMonitor(true);
 }
コード例 #2
0
  /** @generated */
  public boolean performFinish() {
    IRunnableWithProgress op =
        new WorkspaceModifyOperation(null) {

          protected void execute(IProgressMonitor monitor)
              throws CoreException, InterruptedException {
            diagram =
                PinsDiagramEditorUtil.createDiagram(
                    diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor);
            if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
              try {
                PinsDiagramEditorUtil.openDiagram(diagram);
              } catch (PartInitException e) {
                ErrorDialog.openError(
                    getContainer().getShell(),
                    Messages.PinsCreationWizardOpenEditorError,
                    null,
                    e.getStatus());
              }
            }
          }
        };
    try {
      getContainer().run(false, true, op);
    } catch (InterruptedException e) {
      return false;
    } catch (InvocationTargetException e) {
      if (e.getTargetException() instanceof CoreException) {
        ErrorDialog.openError(
            getContainer().getShell(),
            Messages.PinsCreationWizardCreationError,
            null,
            ((CoreException) e.getTargetException()).getStatus());
      } else {
        PinsDiagramEditorPlugin.getInstance()
            .logError("Error creating diagram", e.getTargetException()); // $NON-NLS-1$
      }
      return false;
    }
    return diagram != null;
  }
コード例 #3
0
 /** @generated */
 public void run(IAction action) {
   TransactionalEditingDomain editingDomain =
       GMFEditingDomainFactory.INSTANCE.createEditingDomain();
   ResourceSet resourceSet = editingDomain.getResourceSet();
   EObject diagramRoot = null;
   try {
     Resource resource = resourceSet.getResource(domainModelURI, true);
     diagramRoot = (EObject) resource.getContents().get(0);
   } catch (WrappedException ex) {
     PinsDiagramEditorPlugin.getInstance()
         .logError("Unable to load resource: " + domainModelURI, ex); // $NON-NLS-1$
   }
   if (diagramRoot == null) {
     MessageDialog.openError(
         getShell(),
         Messages.InitDiagramFile_ResourceErrorDialogTitle,
         Messages.InitDiagramFile_ResourceErrorDialogMessage);
     return;
   }
   Wizard wizard = new PinsNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
   wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle, DiagramEditPart.MODEL_ID));
   PinsDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); // $NON-NLS-1$
 }