Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IResource


  public IResource[] members(IResource resource) throws TeamException {
      synchronized (_refreshLock ) {
        Map<IPath, IResource> existingChildren = new HashMap<IPath, IResource>()
        for (IPath path : _localStates.keySet()) {
            if (isAffected(path, true)) {
              IResource child = convertToResource(_localStates.get(path));
              if (child != null) {
                _localStatesByResource.put(child, _localStates.get(path));
                // add highest parent
                IResource parent = child;
                while (parent != null) {
                  IResource grandParent = parent.getParent();
                  if (grandParent != null && grandParent.getFullPath().equals(resource.getFullPath())) {
                    existingChildren.put(parent.getFullPath(), parent);
                    break;
                  }
                  parent = grandParent;               
                }
              }
            }
        }
        for (IPath path : _remoteStates.keySet()) {
          if (isAffected(path, false)) {
            IResource child = convertToResource(_remoteStates.get(path));
            if (child != null) {
              _remoteStatesByResource.put(child, _remoteStates.get(path));
              // add highest parent
              IResource parent = child;
              while (parent != null) {
                IResource grandParent = parent.getParent();
                if (grandParent != null && grandParent.getFullPath().equals(resource.getFullPath())) {
                  existingChildren.put(parent.getFullPath(), parent);           
                  break;
                }
                parent = grandParent;             
              }
            }
          }
        }

        IResource virtualPluginRoot = retrieveVirtualPluginRoot(_runtime);
        if (resource instanceof IProject) {            
            existingChildren.put(virtualPluginRoot.getFullPath(), virtualPluginRoot);
        } else if (resource.getFullPath().equals(virtualPluginRoot.getFullPath())) {
            for (IResource virtualPluginResource : _localPluginInfos.keySet()) {
                existingChildren.put(virtualPluginResource.getFullPath(), virtualPluginResource);
            }
            for (IResource virtualPluginResource : _remotePluginInfos.keySet()) {
                    existingChildren.put(virtualPluginResource.getFullPath(), virtualPluginResource);
View Full Code Here


       
        _localPluginInfos.clear();
        _remotePluginInfos.clear();
       
        monitor.beginTask("retrieving local resource states", IProgressMonitor.UNKNOWN);
        IResource start = _runtime.getDesignRoot();

        List<LocalFSDesignResourceState> localStates = buildFSDesignResourceStates(start, _runtime.getDesignRoot().getFullPath());
        //print(localStates);
               
        monitor.setTaskName("connecting to remote server '" + _server.getName() + "'.");
        _server.connectToServer();       
        monitor.setTaskName("retrieving remote resouce states");
        List<FSDesignResourceState> remoteStates = _server.getServices().retrieveFSDesignResourceState(_server.getSession(), computeRelativPathFromDesignRoot(start).toString());
       
        // map states by path rooted to wga designroot
        for (LocalFSDesignResourceState state : localStates) {
          IPath path = new Path(state.getPath());
          _localStates.put(path.makeRelative(), state);
        }       
        for (FSDesignResourceState state : remoteStates) {
          IPath path = new Path(state.getPath());
          _remoteStates.put(path.makeRelative(), state);   
        }
       
        // perform steps for plugin sync if runtime is started
        if (TomcatUtils.getInstance().isRunning(_runtime)) {
            monitor.beginTask("connecting to local WGA server", IProgressMonitor.UNKNOWN);
            WGARemoteServer local = _runtime.createRemoteServer();
            local.connectToServer();
           
            Version localWGAVersion = null;
                    try {
                        monitor.beginTask("retrieving local WGA server version", IProgressMonitor.UNKNOWN);
                        localWGAVersion = local.getServices().getWGAVersion(local.getSession());
                    }
                    catch (Exception e) {
                        // this might happen if server version is < 5.3
                    }
                    try {
                        monitor.beginTask("retrieving remote WGA server version", IProgressMonitor.UNKNOWN);
                        _remoteWGAVersion = _server.getServices().getWGAVersion(_server.getSession());
                    }
                    catch (Exception e) {
                        // this might happen if server version is < 5.3
                    }
                   
                   
                    // check local and remote WGA version - plugin sync is available for WGA >= 5.3
                    if (localWGAVersion != null && localWGAVersion.isAtLeast(5, 3) && _remoteWGAVersion != null && _remoteWGAVersion.isAtLeast(5, 3)) {                               
                monitor.beginTask("retrieving local plugin infos", IProgressMonitor.UNKNOWN);
                               
                List<PluginInfo> infos = local.getServices().getPluginInformation(local.getSession());
                for (PluginInfo info : infos) {
                    // we will sync only active & valid plugins ... dev plugins & platform plugins are excluded
                    if (info.isActive() && info.isValid() && !info.isPlatformPlugin() && !info.isDeveloperPlugin()) {
                        IResource virtualPluginResource = buildVirtualPluginResource(_runtime, info);
                        _localPluginInfos.put(virtualPluginResource, info);
                    }
                }
               
                monitor.beginTask("retrieving remote plugin infos", IProgressMonitor.UNKNOWN);               
                        infos = _server.getServices().getPluginInformation(_server.getSession());
                        for (PluginInfo info : infos) {
                            // we will sync only active & valid plugins ... dev plugins & platform plugins are excluded
                            if (info.isActive() && info.isValid() && !info.isPlatformPlugin() && !info.isDeveloperPlugin()) {
                                IResource virtualPluginResource = buildVirtualPluginResource(_runtime, info);
                                _remotePluginInfos.put(virtualPluginResource, info);
                            }
                        }
                    }
        }
View Full Code Here

      } else {
        path = _runtime.getDesignRoot().getFullPath().append(new Path(state.getPath()));
      }     
    }
   
    IResource resource = null;
    if (state.getType() == FSDesignResourceState.TYPE_FOLDER) {
      resource = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);           
    } else {       
      resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path);         
    }
View Full Code Here

            return workingSet.getName();
        }
    
       
        if (selection instanceof IResource){
            IResource resource = (IResource) selection;
            IProject project = resource.getProject();
            IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
          
           
           
            for(IWorkingSet currentSet : workingSets){
View Full Code Here

    if (_selection instanceof StructuredSelection) {
      StructuredSelection treeSel = (StructuredSelection) _selection;
      Object selectedElement = treeSel.getFirstElement();

      if (selectedElement instanceof IResource) {
        IResource resource = (IResource) selectedElement;
        IProject selectedRuntimeProject = resource.getProject();
        try {
          _selectedRuntime = (WGARuntime) selectedRuntimeProject.getNature(WGADesignerPlugin.NATURE_WGA_RUNTIME);
        } catch (CoreException e) {
          WGADesignerPlugin.getDefault().logError("This project does not exist. This project is not open. The project nature extension could not be found.", e);
        }
View Full Code Here

  public IFolder[] getDesignsAsFolder(boolean resolveDirlinks) {
    List<IFolder> folders = new ArrayList<IFolder>();
    IFolder designroot = (IFolder) getDesignRoot();
    try {
      IResource resources[] = designroot.members(IFolder.FOLDER);
      for (int i = 0; i < resources.length; i++) {

        if (resources[i] instanceof IFolder) {
          IFolder current = (IFolder) resources[i];
View Full Code Here

  public IFolder[] getPluginsAsFolder(boolean resolveDirlinks) {
    List<IFolder> folders = new ArrayList<IFolder>();
    IFolder pluginroot = (IFolder) getPluginRoot();
    try {
      IResource resources[] = pluginroot.members(IFolder.FOLDER);
      for (int i = 0; i < resources.length; i++) {

        if (resources[i] instanceof IFolder) {
          IFolder current = (IFolder) resources[i];
View Full Code Here

        ISynchronizeModelElement node = (ISynchronizeModelElement)element;
        if(node instanceof IAdaptable) {
          SyncInfo info = (SyncInfo)((IAdaptable)node).getAdapter(SyncInfo.class);
          if (info != null) {
            Image result = null;
            IResource resource = info.getLocal();
            result = _designFolderDecorator.decorateImage(image, element);           
            if (result != null) {
              result = _natureDecorator.decorateImage(result, element);
            }
          }
View Full Code Here

      _markerAnnotation = markerAnnotation;
      _refPath = _markerAnnotation.getMarker().getAttribute(ReferenceValidator.ATTRIBUTE_MISSING_REFERENCE_PATH, "");
    }

    public void apply(IDocument document) {
      IResource resource = _markerAnnotation.getMarker().getResource();
      if (resource instanceof IFile) {
        IFile referer = (IFile) resource;
        IFolder tmlFolder = new WGADesignStructureHelper(referer).getTmlRoot();
        IFile fileToCreate = tmlFolder.getFile(new Path(_refPath));
        if (!fileToCreate.exists()) {
View Full Code Here

      _markerAnnotation = markerAnnotation;
      _refPath = _markerAnnotation.getMarker().getAttribute(ReferenceValidator.ATTRIBUTE_MISSING_REFERENCE_PATH, "");
    }

    public void apply(IDocument document) {
      IResource resource = _markerAnnotation.getMarker().getResource();
      if (resource instanceof IFile) {
        IFile referer = (IFile) resource;
        WGADesignStructureHelper helper = new WGADesignStructureHelper(referer);
        IFolder scriptFolder = helper.getScriptsRoot();
        IFile fileToCreate = scriptFolder.getFile(new Path(_refPath));
View Full Code Here

TOP

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

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.