コード例 #1
0
ファイル: EclipseUtil.java プロジェクト: debabratahazra/DS
 /**
  * @return true => both current dir and default project are not null or empty. false => at least
  *     one of them is either null or empty ("")
  */
 public static boolean isLocalDirAndProjectSet() {
   boolean setOk = false;
   String localCurrentDir = EclipseUtil.getLocalCurDirectory(EclipseUtil.isSaveLocallyOn());
   String localDefaultProject = EclipseUtil.getLocalDefaultProject();
   if ((!"".equals(localCurrentDir) && (localCurrentDir != null))
       && (!"".equals(localDefaultProject) && (localDefaultProject != null))) {
     setOk = true;
   }
   return setOk;
 }
コード例 #2
0
ファイル: T24BasicEditor.java プロジェクト: debabratahazra/DS
  /**
   * Updates the annotations registered with this editor.
   *
   * @param positions
   */
  public void updateFoldingStructure(ArrayList<Position> newPositions) {
    Map<ProjectionAnnotation, Position> saveAllAnnotations =
        new HashMap<ProjectionAnnotation, Position>();
    saveAllAnnotations.putAll(curAnnotations);

    try {
      String setDefaultCollapsedProperty =
          EclipseUtil.getPreferenceStore().getString(PluginConstants.T24_ALWAYS_COLLAPSE_REGION);
      boolean setDefaultCollapsed = Boolean.parseBoolean(setDefaultCollapsedProperty);
      // this will hold the new annotations along
      // with their corresponding positions
      Map<ProjectionAnnotation, Position> newAnnotations =
          new HashMap<ProjectionAnnotation, Position>();
      for (int i = 0; i < newPositions.size(); i++) {
        ProjectionAnnotation an = annotationAlreadyExists((Position) newPositions.get(i));
        ProjectionAnnotation annotation;
        if (an == null) {
          // The annotation doesn't exist yet, so create it brand new.
          annotation = new ProjectionAnnotation();
          annotation.setRangeIndication(false);
          annotation.setText("Annotation " + i);
          if (setDefaultCollapsed) {
            annotation.markCollapsed();
          } else {
            annotation.markExpanded();
          }
          Position pos = newPositions.get(i);
          newAnnotations.put(annotation, pos);
          saveAllAnnotations.put(annotation, pos);
        } else {
          if (setDefaultCollapsed) {
            an.markCollapsed();
          } else {
            an.markExpanded();
          }
          newAnnotations.put(an, newPositions.get(i));
          saveAllAnnotations.put(an, newPositions.get(i));
        }
      }
      Set<ProjectionAnnotation> keys = curAnnotations.keySet();
      Iterator<ProjectionAnnotation> keyIt = keys.iterator();
      Annotation[] annotations = new Annotation[curAnnotations.size()];
      int annotationCount = 0;
      while (keyIt.hasNext()) {
        ProjectionAnnotation an = (ProjectionAnnotation) keyIt.next();
        annotations[annotationCount++] = an;
        saveAllAnnotations.remove(an);
      }
      if (annotationModel != null) {
        annotationModel.modifyAnnotations(annotations, newAnnotations, null);
      } else {
        createAnnotationModel();
      }
      curAnnotations = saveAllAnnotations;
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #3
0
 private String getLocalPath(String changeSetRef, int workItemRef) {
   String localPath = null;
   localPath =
       EclipseUtil.getTemporaryProject().toOSString()
           + "/T24ChangeSets/"
           + "WI-"
           + workItemRef
           + "-"
           + changeSetRef;
   return localPath;
 }