Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IContainer


  public Object[] getElements(Object inputElement) {
      final List<IFile> fileList = new ArrayList<IFile>();
    if (inputElement instanceof File) {
      File root = (File) inputElement;   
      IContainer rootContainer = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(root.getAbsolutePath()));
     
      try {
                rootContainer.accept(new IResourceVisitor() {
                   
                    public boolean visit(IResource resource) throws CoreException {
                        if(resource instanceof IFolder){
                            return true;
                        }
View Full Code Here


    if (selectedResource instanceof IFile) {
      selectedResource = (IContainer) selectedResource.getParent();
    }
   
    if (selectedResource instanceof IContainer) {
      IContainer selectedFolder = (IContainer) selectedResource;
      while (!(selectedFolder instanceof IProject) && selectedFolder != null) {

        if (WGADesignStructureHelper.isDesignFolder(selectedFolder)) {
          return new SingleStructuredSelection(selectedFolder.getFolder(new Path(getPathNameUnderDesign())));
        }       

        if (getFilter().select(selectedFolder)) {
          return new SingleStructuredSelection(selectedFolder);
        }
        selectedFolder = selectedFolder.getParent();
      }
      if (selectedFolder != null) {
        return new SingleStructuredSelection(selectedFolder);
      }
    }
View Full Code Here

  }

  class NameSorter extends ViewerSorter {
    public int compare(Viewer viewer, Object e1, Object e2) {
      if (e1 instanceof IContainer && e2 instanceof IContainer) {
        IContainer ct1 = (IContainer) e1;
        IContainer ct2 = (IContainer) e2;
        return ct1.getName().toLowerCase().compareTo(ct2.getName().toLowerCase());
      }
      return 0;

    }
View Full Code Here

    List<IResource> roots = new ArrayList<IResource>();
    roots.add(_runtime.getProject());
    IFolder[] designFolders = _runtime.getDesignsAsFolder(false);
    for (IFolder designFolder : designFolders) {
      if (WGADesignStructureHelper.isDirlinkFolder(designFolder)) {
        IContainer dirlinkTarget = WGADesignStructureHelper.resolveDirLink(designFolder.getFile(WGUtils.DIRLINK_FILE));
        roots.add(dirlinkTarget.getProject());
      }
    }
    return roots.toArray(new IResource[0]);
  }
View Full Code Here

  private List<LocalFSDesignResourceState> buildFSDesignResourceStates(IResource resource, IPath base) throws CoreException {
    List<LocalFSDesignResourceState> states = new ArrayList<LocalFSDesignResourceState>();
 
    if (resource instanceof IFolder && WGADesignStructureHelper.isDirlinkFolder((IFolder)resource)) {
      // we have to resolve dirlink
      IContainer dirlinkTarget = WGADesignStructureHelper.resolveDirLink(((IFolder)resource).getFile(WGUtils.DIRLINK_FILE));
      if (dirlinkTarget != null && dirlinkTarget.isAccessible()) {
          states.addAll(buildDirLinkFSDesignResourceStates(dirlinkTarget, resource.getName(), dirlinkTarget));
      }
    } else {
      LocalFSDesignResourceState state = new LocalFSDesignResourceState();
      states.add(state);
      state.setFqPath(resource.getFullPath());
      state.setPath(computeRelativPathFrom(resource, base).makeRelative().toString());   
      if (resource instanceof IContainer) {
        state.setType(FSDesignResourceState.TYPE_FOLDER);
        IContainer container = (IContainer) resource;
        for (IResource child : container.members()) {
          List<LocalFSDesignResourceState> childStates = buildFSDesignResourceStates(child, base);
          states.addAll(childStates);
        }
      } else if (resource instanceof IFile) {
        IFile file = (IFile) resource;
View Full Code Here

    state.setDirLinkTarget(linkTarget);
    state.setFqPath(resource.getFullPath());   
    state.setPath(new Path(linkName).append(computeRelativPathFrom(resource, linkTarget.getFullPath()).makeRelative()).toString());   
    if (resource instanceof IContainer) {
      state.setType(FSDesignResourceState.TYPE_FOLDER);
      IContainer container = (IContainer) resource;
      for (IResource child : container.members()) {
        List<LocalFSDesignResourceState> childStates = buildDirLinkFSDesignResourceStates(linkTarget, linkName, child);
        states.addAll(childStates);
      }
    } else if (resource instanceof IFile) {
      IFile file = (IFile) resource;
View Full Code Here

        String designFolderName = pathElements[0];
        // check if this design is internal or external
        IFolder designFolder = _runtime.getDesignRoot().getFolder(new Path(designFolderName));
        if (WGADesignStructureHelper.isDirlinkFolder(designFolder)) {
          // this is an external design
          IContainer linkTarget = WGADesignStructureHelper.resolveDirLink(designFolder.getFile(WGUtils.DIRLINK_FILE));
          path = linkTarget.getFullPath().append(new Path(state.getPath()).removeFirstSegments(1));
        } else {
          path = _runtime.getDesignRoot().getFullPath().append(new Path(state.getPath()));   
        }
      } else {
        path = _runtime.getDesignRoot().getFullPath().append(new Path(state.getPath()));
View Full Code Here

                    _multiTaskStatusControl.update(taskStatus);
                }
               
                taskStatus = _taskStatusMap.get(DESIGN_TASK);
                try {
                    IContainer designContainer = wizard.getRuntime().getConnectedDesignContainers().get(wizard.getWebApplication());
                    List<FSDesignResourceState> state = wizard.getRemoteServer().getServices().retrieveFSDesignResourceState(wizard.getRemoteServer().getSession(), designContainer.getName());
                    if (!state.isEmpty()) {
                        taskStatus.setSeverity(TaskStatus.WARNING);
                        taskStatus.setMessage("Design for web application already exist on remote server. The design will not be committed during this export. Please sync changes via design synchronization dialog after export.");
                        taskStatus.setSeverityLabel("already exists");
                    } else {
View Full Code Here

        throw new CoreException(new Status(Status.ERROR, WGADesignerPlugin.PLUGIN_ID, "Unable to register external design.", e));
      }
    }

    if (createdb) {
      IContainer container = null;
      if (design instanceof WGADesign) {
        container = ((WGADesign) design).getProject();
      } else {
        container = (IFolder) design;
      }
      WGAConfiguration wgaConfig = null;
      try {
        wgaConfig = retrieveWGAConfig(true);
      } catch (IncompatibleWGAConfigVersion e) {
        MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning",
            "Unable to register design in runtime. WGA Version seams to be incompatible. Please ensure you are using the latest version of WGADevelopmentStudio.");
        WGADesignerPlugin.getDefault().logError(e.getMessage(), e);
      } catch (IOException e) {
        throw new CoreException(new Status(Status.ERROR, WGADesignerPlugin.PLUGIN_ID, "Unable to create default wga configuration.", e));
      }

      if (wgaConfig != null) {
        if (dbkey == null) {
          dbkey = container.getName();
        }
        dbkey = dbkey.toLowerCase();
        if (title == null) {
          title = container.getName();
        }
        if (domain == null) {
          domain = wgaConfig.getDefaultDomain();
        }
        // check if db already exists
        boolean csExists = wgaConfig.hasContentDatabase(dbkey);
        if (csExists) {
          throw new CoreException(new Status(Status.ERROR, WGADesignerPlugin.PLUGIN_ID, "A database with key '" + dbkey + "' already exists."));
        } else {
          int existingDbs = wgaConfig.getContentDatabases().size();
          ContentStore cs = wgaConfig.createContentStoreOnEmbeddedServer(dbkey, container.getName());
          cs.setDomain(domain.getUid());
          cs.setTitle(title);

          if (properties != null) {
            cs.setDefaultLanguage(properties.getProperty(DesignTemplate.PROP_DEFAULT_LANGUAGE, Locale.getDefault().getLanguage()));
View Full Code Here

                        _remoteServer.getServices().createDatabase(_remoteServer.getSession(), _remoteDatabaseServer, _remoteDatabaseServer.getCreateableContentStoreImplemenations().get(0),
                                pathOptions);
                        monitor.worked(1);

                        monitor.setTaskName("transfering design");
                        IContainer designContainer = _runtime.getConnectedDesignContainers().get(_webApplication);
                        designContainer.accept(new IResourceVisitor() {

                            public boolean visit(IResource resource) throws CoreException {
                                IPath remotePathObj = resource.getLocation();
                                int count = remotePathObj.matchingFirstSegments(_runtime.getDesignRoot().getLocation());
                                remotePathObj = remotePathObj.removeFirstSegments(count);
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.IContainer

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.