コード例 #1
0
 @Override
 public void createPages() {
   super.createPages();
   URI resourceURI =
       EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
   selectionViewer.setInput(editingDomain.getResourceSet().getResource(resourceURI, true));
 }
コード例 #2
0
 public void createModel() {
   super.createModel();
   URI resourceURI =
       EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
   editingDomain
       .getResourceToReadOnlyMap()
       .put(editingDomain.getResourceSet().getResource(resourceURI, true), true);
 }
コード例 #3
0
ファイル: RmapEditor.java プロジェクト: eclipse/buckminster
  /**
   * This is the method called to load a resource into the editing domain's resource set based on
   * the editor's input.
   * <!-- begin-user-doc -->
   * <!--
   * end-user-doc -->
   *
   * @generated
   */
  public void createModel() {
    URI resourceURI = EditUIUtil.getURI(getEditorInput());
    Exception exception = null;
    Resource resource = null;
    try {
      // Load the resource through the editing domain.
      //
      resource = editingDomain.getResourceSet().getResource(resourceURI, true);
    } catch (Exception e) {
      exception = e;
      resource = editingDomain.getResourceSet().getResource(resourceURI, false);
    }

    Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
    if (diagnostic.getSeverity() != Diagnostic.OK) {
      resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
    }
    editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
  }
コード例 #4
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public static boolean openEditor(IWorkbench workbench, URI uri) {
    IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();

    IEditorDescriptor editorDescriptor = EditUIUtil.getDefaultEditor(uri, null);
    if (editorDescriptor == null) {
      MessageDialog.openError(
          workbenchWindow.getShell(),
          getString("_UI_Error_title"),
          getString("_WARN_No_Editor", uri.lastSegment()));
      return false;
    } else {
      try {
        page.openEditor(new URIEditorInput(uri), editorDescriptor.getId());
      } catch (PartInitException exception) {
        MessageDialog.openError(
            workbenchWindow.getShell(),
            getString("_UI_OpenEditorError_label"),
            exception.getMessage());
        return false;
      }
    }
    return true;
  }