示例#1
0
 @Override
 public void saveState(IMemento memento) {
   super.saveState(memento);
   saveColumnWidths();
   memento.putInteger(KEY_DEFINITION_COLUMN_WIDTH, fColumnWidths[DEFINITION_COLUMN_INDEX]);
   memento.putInteger(KEY_LOCATION_COLUMN_WIDTH, fColumnWidths[LOCATION_COLUMN_INDEX]);
   memento.putInteger(KEY_MATCH_COLUMN_WIDTH, fColumnWidths[MATCH_COLUMN_INDEX]);
   memento.putBoolean(KEY_SHOW_ENCLOSING_DEFINITIONS, fShowEnclosingDefinitions);
 }
 @Override
 public void save(IMemento memento, Object value) {
   FontStyle style = (FontStyle) value;
   if (style.getFont() != null) {
     memento.putString(FONT_NAME, style.getFont().getFamily());
     memento.putInteger(STYLE, style.getFont().getStyle());
     memento.putInteger(SIZE, style.getFont().getSize());
   }
 }
示例#3
0
 public void saveState(IMemento memento) {
   super.saveState(memento);
   memento = memento.createChild(ID);
   memento.putString("date", date);
   memento.putInteger("objHash", objHash);
   memento.putString("objName", objName);
   memento.putString("counter", counter);
   memento.putString("objType", objType);
   memento.putInteger("serverId", serverId);
 }
 @Override
 public void saveState(IMemento memento) {
   super.saveState(memento);
   memento.putInteger(DETAILS_VIEW_FLYOUT_STATE, detailsViewerFlyout.getPreferences().getState());
   memento.putInteger(
       PATTERNS_VIEWER_FLYOUT_STATE, patternsViewerFlyout.getPreferences().getState());
   memento.putString(
       PACKAGE_PRESENTATION_STATE,
       (patternsTreeViewer.getContentProvider() == flatCP) ? "flat" : "hierarchical");
 }
  public void testPreferenceMigration() throws Exception {
    final TaskListSorter sorter = new TaskListSorter();
    TaskListView view = new TaskListView();
    XMLMemento memento = XMLMemento.createWriteRoot(MEMENTO_KEY_SORT_INDEX);
    IMemento child = memento.createChild(MEMENTO_KEY_SORTER);
    child.putInteger(MEMENTO_KEY_SORT_INDEX, 0);
    child.putInteger(MEMENTO_KEY_SORT_DIRECTION, 1);
    child = memento.createChild(MEMENTO_KEY_SORTER2);
    child.putInteger(MEMENTO_KEY_SORT_INDEX, 1);
    child.putInteger(MEMENTO_KEY_SORT_DIRECTION, -1);
    view.migrateSorterState(sorter, memento);
    assertEquals(
        SortCriterion.SortKey.PRIORITY, sorter.getComparator().getSortCriterion(0).getKey());
    assertEquals(1, sorter.getComparator().getSortCriterion(0).getDirection());
    assertEquals(
        SortCriterion.SortKey.SUMMARY, sorter.getComparator().getSortCriterion(1).getKey());
    assertEquals(-1, sorter.getComparator().getSortCriterion(1).getDirection());

    memento = XMLMemento.createWriteRoot(MEMENTO_KEY_SORT_INDEX);
    child = memento.createChild(MEMENTO_KEY_SORTER);
    child.putInteger(MEMENTO_KEY_SORT_INDEX, 3);
    child.putInteger(MEMENTO_KEY_SORT_DIRECTION, -1);
    child = memento.createChild(MEMENTO_KEY_SORTER2);
    child.putInteger(MEMENTO_KEY_SORT_INDEX, 2);
    child.putInteger(MEMENTO_KEY_SORT_DIRECTION, -1);
    view.migrateSorterState(sorter, memento);
    assertEquals(
        SortCriterion.SortKey.TASK_ID, sorter.getComparator().getSortCriterion(0).getKey());
    assertEquals(-1, sorter.getComparator().getSortCriterion(0).getDirection());
    assertEquals(
        SortCriterion.SortKey.DATE_CREATED, sorter.getComparator().getSortCriterion(1).getKey());
    assertEquals(-1, sorter.getComparator().getSortCriterion(1).getDirection());
  }
示例#6
0
  public void saveState(IMemento memento) {
    for (int i = 0; i < infos.length; i++) {
      SortInfo info = infos[i];
      IMemento mem = memento.createChild(TAG_TYPE);
      mem.putInteger(TAG_COLUMN_INDEX, info.columnIndex);

      if (info.descending) mem.putString(TAG_DESCENDING, TAG_TRUE);
    }
  }
示例#7
0
 public void save(IMemento memento) {
   memento.putString(LABEL_KEY, text);
   memento.putInteger(HORIZ_ALIGN_KEY, horizontalAlignment);
   if (originalFont != null) {
     memento.putString(FONT_NAME_KEY, originalFont.getFamily());
     memento.putInteger(STYLE_KEY, originalFont.getStyle());
     memento.putInteger(SIZE_KEY, originalFont.getSize());
     memento.putFloat(FONT_SCALE_FACTOR, getScaleFactor());
   }
   if (fontColor != null) {
     StringBuilder clrString = new StringBuilder();
     clrString.append(fontColor.getRed());
     clrString.append(",");
     clrString.append(fontColor.getGreen());
     clrString.append(",");
     clrString.append(fontColor.getBlue());
     memento.putString(FONT_COLOR_KEY, clrString.toString());
   }
 }
示例#8
0
 /** Saves the code folding state into the given memento. */
 public void saveCodeFolding(org.eclipse.ui.IMemento memento) {
   java.util.Iterator<?> annotationIt = projectionAnnotationModel.getAnnotationIterator();
   while (annotationIt.hasNext()) {
     org.eclipse.jface.text.source.projection.ProjectionAnnotation annotation =
         (org.eclipse.jface.text.source.projection.ProjectionAnnotation) annotationIt.next();
     org.eclipse.ui.IMemento annotationMemento = memento.createChild(ANNOTATION);
     org.eclipse.jface.text.Position position = projectionAnnotationModel.getPosition(annotation);
     annotationMemento.putBoolean(IS_COLLAPSED, annotation.isCollapsed());
     annotationMemento.putInteger(OFFSET, position.offset);
     annotationMemento.putInteger(LENGTH, position.length);
   }
 }
  /* (non-Javadoc)
   * @see org.eclipse.ui.IPersistableElement#saveState(org.eclipse.ui.IMemento)
   */
  public void saveState(IMemento memento) {
    String root_id = m_input.getModelRoot().getId();
    Ooaofooa modelRoot = Ooaofooa.getInstance(root_id, false);

    memento.putString(GraphicalEditorFactory.TAG_MODELROOTID, m_input.getModelRoot().getId());
    memento.putString(GraphicalEditorFactory.TAG_OOAID, m_input.getOoa_id().toString());
    memento.putInteger(GraphicalEditorFactory.TAG_OOATYPE, m_input.getOoa_type());
    memento.putInteger(GraphicalEditorFactory.TAG_MODELTYPE, m_input.getModel_type());
    NonRootModelElement nrme = (NonRootModelElement) m_input.getRepresents();
    if (nrme == null) {
      nrme =
          (NonRootModelElement)
              Cl_c.Getinstancefromooa_id(modelRoot, m_input.getOoa_id(), m_input.getOoa_type());
    }

    // if there's no way to get a component path, then don't save the tag
    // CanvasFactory.createElement() will check for the tag's existence
    // before doing anything
    if (nrme != null) {
      memento.putString(GraphicalEditorFactory.TAG_COMPONENTPATH, nrme.getContent());
    }
  }
示例#10
0
  @Override
  public void saveState(IMemento memento) {
    for (Iterator<Entry<IPageBookViewPage, DummyPart>> iter = fPagesToParts.entrySet().iterator();
        iter.hasNext(); ) {
      Entry<IPageBookViewPage, DummyPart> entry = iter.next();
      ISearchResultPage page = (ISearchResultPage) entry.getKey();
      DummyPart part = entry.getValue();

      IMemento child = memento.createChild(MEMENTO_TYPE, page.getID());
      page.saveState(child);
      child.putInteger(MEMENTO_KEY_LAST_ACTIVATION, part.getLastActivation());
    }
  }
  @Override
  public boolean store(ITargetPhone aPhone, IMemento memento) {
    if (aPhone instanceof BTTargetPhone) {
      BTTargetPhone phone = (BTTargetPhone) aPhone;
      String addr = Util.toBase16(phone.getAddressAsBytes());
      int port = phone.getPort();

      memento.putString("addr", addr);
      memento.putInteger("port", phone.getPort());
      return true;
    } else {
      return false;
    }
  }
示例#12
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento)
   */
  @Override
  public void saveState(IMemento memento) {
    memento.putInteger(K_ZOOM_FACTOR, viewer.getZoomFactor());

    int[] weights = viewer.getWeights();
    if (weights.length > 1) {
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < weights.length; i++) {
        if (i != 0) {
          sb.append(";"); // $NON-NLS-1$
        }
        sb.append(weights[i]);
      }
      memento.putString("weights", sb.toString()); // $NON-NLS-1$
    }

    super.saveState(memento);
  }
示例#13
0
 @Override
 public void saveState(IMemento memento) {
   super.saveState(memento);
   memento.putInteger(KEY_LIMIT, getElementLimit().intValue());
 }
示例#14
0
 /*
  * @see org.eclipse.ui.IViewPart#saveState(org.eclipse.ui.IMemento)
  */
 public void saveState(IMemento memento) {
   super.saveState(memento);
   memento.putInteger(this.getViewSite().getId() + TAG_VIEW_STATE, fCurrViewState);
 }
 @Override
 public void saveSettings(IMemento memento) {
   memento.putInteger(COMPLETION_ATTRIBUTE, completion);
 }
 private void saveLinkingEnabled(IMemento memento) {
   memento.putInteger(getLinkToEditorKey(), fLinkingEnabled ? 1 : 0);
 }
 @Override
 public void saveSettings(IMemento memento) {
   memento.putInteger(TAG_SELECTED_PRIORITIES, selectedPriorities);
 }