コード例 #1
0
 private void createProjectFolder(final IProject project, final String name) {
   if ((name != null) && (name.length() != 0)) {
     IFolder folder = project.getFolder(new Path(name));
     if (!folder.exists()) {
       try {
         folder.create(IResource.FORCE, true, null);
       } catch (CoreException cExc) {
         Activator.logException(cExc);
       }
     }
   }
 }
コード例 #2
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
  */
 public void treeCollapsed(final TreeExpansionEvent event) {
   Object element = event.getElement();
   if ((element instanceof IGridContainer) && ((IGridContainer) element).isLazy()) {
     IGridContainer container = (IGridContainer) element;
     this.progressNodes.remove(container);
     container.setDirty();
     try {
       container.deleteAll();
     } catch (ProblemException pExc) {
       Activator.logException(pExc);
     }
   }
 }
コード例 #3
0
  /**
   * Get the children of the specified container. If the container is lazy and dirty the returned
   * array will contain only one element, i.e. a {@link ProgressRunner} that is used to monitor the
   * progress of the children fetching operation that will be started immediately by this method.
   *
   * @param container The container from which to fetch the children.
   * @return An array containing either the list of children or a {@link ProgressRunner} object.
   */
  protected Object[] getChildren(final IGridContainer container) {

    Object[] children = null;

    if (container.isLazy() && container.isDirty()) {

      ProgressTreeNode monitor = this.progressNodes.get(container);

      if (monitor == null) {

        FetchChildrenJob fetcher =
            new FetchChildrenJob(container, this.treeViewer.getControl().getShell());
        monitor = new ProgressTreeNode(this.treeViewer);
        this.progressNodes.put(container, monitor);
        fetcher.setExternalMonitor(monitor);
        fetcher.setSystem(true);
        fetcher.schedule();
      }

      children = new Object[] {monitor};

    } else {

      this.progressNodes.remove(container);

      try {
        IGridElement[] childElements = container.getChildren(null);
        List<IGridElement> visibleChildren = new ArrayList<IGridElement>();
        for (IGridElement child : childElements) {
          if (!child.isHidden()) {
            visibleChildren.add(child);
          }
        }
        children = visibleChildren.toArray(new IGridElement[visibleChildren.size()]);
      } catch (ProblemException pExc) {
        if (this.treeViewer != null) {
          Shell shell = this.treeViewer.getControl().getShell();
          ProblemDialog.openProblem(
              shell,
              Messages.getString("GridModelContentProvider.problem_title"), // $NON-NLS-1$
              Messages.getString("GridModelContentProvider.problem_text")
                  + container.getName(), // $NON-NLS-1$
              pExc);
        } else {
          Activator.logException(pExc);
        }
      }
    }

    return children;
  }
コード例 #4
0
  public void run(final IProgressMonitor monitor)
      throws InvocationTargetException, InterruptedException {

    monitor.beginTask(
        Messages.getString("GridProjectCreationOperation.create_task"), 300); // $NON-NLS-1$

    try {
      IProject proj = createProject(this.properties, monitor);
      addProjectNature(proj, monitor);
      this.gridProject = proj;
    } catch (CoreException cExc) {
      eu.geclipse.ui.internal.Activator.logException(cExc);
    } finally {
      monitor.done();
    }
  }