Package org.eclipse.emf.common.util

Examples of org.eclipse.emf.common.util.URI


     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected boolean validatePage() {
      URI fileURI = getFileURI();
      if (fileURI == null || fileURI.isEmpty()) {
        setErrorMessage(null);
        return false;
      }

      String extension = fileURI.fileExtension();
      if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
        String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
        setErrorMessage(OntoUMLEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
        return false;
      }
View Full Code Here


   * @generated
   */
  public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof IFile) {
      IFile file = (IFile) parentElement;
      URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
          .toString(), true);
      Resource resource = myEditingDomain.getResourceSet().getResource(
          fileURI, true);
      return wrapEObjects(myAdapterFctoryContentProvier
          .getChildren(resource), parentElement);
View Full Code Here

      }
      if (nextEObject instanceof Diagram) {
        break;
      }
    }
    URI uri = EcoreUtil.getURI(diagram);
    String editorName = uri.lastSegment()
        + "#" + diagram.eResource().getContents().indexOf(diagram); //$NON-NLS-1$
    IEditorInput editorInput = new URIEditorInput(uri, editorName);
    return editorInput;
  }
View Full Code Here

   * @generated
   */
  public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof IFile) {
      IFile file = (IFile) parentElement;
      URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
          .toString(), true);
      Resource resource = myEditingDomain.getResourceSet().getResource(
          fileURI, true);
      Collection result = new ArrayList();
      result.addAll(createNavigatorItems(selectViewsByType(resource
View Full Code Here

  protected void setDocumentContent(IDocument document, IEditorInput element)
      throws CoreException {
    IDiagramDocument diagramDocument = (IDiagramDocument) document;
    TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
    if (element instanceof URIEditorInput) {
      URI uri = ((URIEditorInput) element).getURI();
      Resource resource = null;
      try {
        resource = domain.getResourceSet().getResource(
            uri.trimFragment(), false);
        if (resource == null) {
          resource = domain.getResourceSet().createResource(
              uri.trimFragment());
        }
        if (!resource.isLoaded()) {
          try {
            Map options = new HashMap(GMFResourceFactory
                .getDefaultLoadOptions());
            // @see 171060
            // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
            resource.load(options);
          } catch (IOException e) {
            resource.unload();
            throw e;
          }
        }
        if (uri.fragment() != null) {
          EObject rootElement = resource.getEObject(uri.fragment());
          if (rootElement instanceof Diagram) {
            document.setContent((Diagram) rootElement);
            return;
          }
        } else {
View Full Code Here

      } catch (RuntimeException x) {
        fireElementStateChangeFailed(element);
        throw x;
      }
    } else {
      URI newResoruceURI;
      List affectedFiles = null;
      if (element instanceof URIEditorInput) {
        newResoruceURI = ((URIEditorInput) element).getURI();
      } else {
        fireElementStateChangeFailed(element);
View Full Code Here

  /**
   * @generated
   */
  private static File getFile(Resource resource) {
    URI resourceUri = resource.getURI();
    if (resourceUri != null && resourceUri.isFile()) {
      File file = new File(resourceUri.toFileString());
      if (!file.isDirectory()) {
        return file;
      }
    }
    return null;
View Full Code Here

   * <!-- 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.
      //
View Full Code Here

  @Override
  public void doSaveAs() {
    String[] filters = FILE_EXTENSION_FILTERS.toArray(new String[FILE_EXTENSION_FILTERS.size()]);
    String[] files = OntoUMLEditorAdvisor.openFilePathDialog(getSite().getShell(), SWT.SAVE, filters);
    if (files.length > 0) {
      URI uri = URI.createFileURI(files[0]);
      doSaveAs(uri, new URIEditorInput(uri));
    }
  }
View Full Code Here

   */
  public boolean performFinish() {
    List affectedFiles = new LinkedList();
    IPath diagramModelPath = myFileCreationPage.getContainerFullPath()
        .append(myFileCreationPage.getFileName());
    URI diagramModelURI = URI.createFileURI(diagramModelPath.toString());
    ResourceSet resourceSet = myEditingDomain.getResourceSet();
    final Resource diagramResource = resourceSet
        .createResource(diagramModelURI);
    AbstractTransactionalCommand command = new AbstractTransactionalCommand(
        myEditingDomain,
View Full Code Here

TOP

Related Classes of org.eclipse.emf.common.util.URI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.