Java Code Examples for org.eclipse.ui.IMemento#putInteger()

The following examples show how to use org.eclipse.ui.IMemento#putInteger() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RealTimeListViewer.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public void saveTo ( final IMemento memento )
{
    if ( memento == null )
    {
        return;
    }

    {
        final IMemento tableMemento = memento.createChild ( "tableCols" ); //$NON-NLS-1$

        for ( int i = 0; i < this.viewer.getTree ().getColumnCount (); i++ )
        {
            final TreeColumn col = this.viewer.getTree ().getColumn ( i );
            tableMemento.putInteger ( "col_" + i, col.getWidth () ); //$NON-NLS-1$
        }
    }

    for ( final ListEntry entry : this.list.getItems () )
    {
        final Item item = entry.getItem ();
        item.saveTo ( memento.createChild ( "item" ) ); //$NON-NLS-1$
    }
}
 
Example 2
Source File: FormatterProfile.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public void toMemento(IMemento memento) {
    cachedActiveProfile = null;     // smth changed. drop cache
    cachedActiveProfileName = null; //

    memento.putString(NAME_UNICAL_KEY, name);
    memento.putBoolean("isDefProfile", isDefProfile); //$NON-NLS-1$
    
    for (IndentSetting bs : IndentSetting.values()) {
        memento.putInteger(bs.name, hmIndentSettings.get(bs.name));
    }
    for (WhiteSpaceSetting wss : WhiteSpaceSetting.values()) {
        memento.putInteger(wss.name(), hmWhiteSettings.get(wss));
    }
    for (NewlineSetting ss : NewlineSetting.values()) {
        memento.putInteger(ss.name() + "_Before", hmStmtSettingsBefore.get(ss)); //$NON-NLS-1$
        memento.putInteger(ss.name() + "_After",  hmStmtSettingsAfter.get(ss)); //$NON-NLS-1$
    }
    memento.putInteger(WRAPPING_WIDTH_MEMENTO_KEY, wrappingWidth); 
}
 
Example 3
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void saveState(IMemento memento) {
	if (fViewer == null && fMemento != null) {
		// part has not been created -> keep the old state
		memento.putMemento(fMemento);
		return;
	}

	memento.putInteger(TAG_ROOT_MODE, fRootMode);
	if (fWorkingSetModel != null)
		fWorkingSetModel.saveState(memento);

	saveLayoutState(memento);
	saveLinkingEnabled(memento);

	if (fActionSet != null) {
		fActionSet.saveFilterAndSorterState(memento);
	}
}
 
Example 4
Source File: FileSearchPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void saveState(IMemento memento) {
    super.saveState(memento);
    memento.putInteger(KEY_SORTING, fCurrentSortOrder);
    try {
        memento.putInteger(KEY_LIMIT, getElementLimit().intValue());
    } catch (Throwable e) {
        //ignore (not available in eclipse 3.2)
    }
}
 
Example 5
Source File: CustomDrawerEditPart.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.eclipse.gef.ui.palette.editparts.PaletteEditPart#saveState(org.eclipse.ui.IMemento)
 */
public void saveState(IMemento memento) {
	RangeModel rModel = getDrawerFigure().getScrollpane().getViewport()
			.getVerticalRangeModel();
	memento.putInteger(RangeModel.PROPERTY_MINIMUM, rModel.getMinimum());
	memento.putInteger(RangeModel.PROPERTY_MAXIMUM, rModel.getMaximum());
	memento.putInteger(RangeModel.PROPERTY_EXTENT, rModel.getExtent());
	memento.putInteger(RangeModel.PROPERTY_VALUE, rModel.getValue());
	super.saveState(memento);
}
 
Example 6
Source File: WorkingSetActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void saveState(IMemento aMemento) {
	super.saveState(aMemento);

	if (aMemento != null) {
		int showWorkingSets = extensionStateModel
				.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0;
		aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets);

		if (workingSet != null) {
			aMemento.putString(TAG_CURRENT_WORKING_SET_NAME, workingSet.getName());
		}
	}

}
 
Example 7
Source File: TmxEditorHistoryItem.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Saves the object state in the given memento.
 * @param memento
 *            the memento to save the object state in
 */
public IStatus saveState(IMemento memento) {
	if (!isRestored()) {
		memento.putMemento(this.memento);
	} else if ((type == TYPE_TMX || type == TYPE_HSTM) && path != null && path.length() != 0) {
		memento.putInteger("type", type);
		memento.putString("path", path);
	}
	return Status.OK_STATUS;
}
 
Example 8
Source File: WorkingSetActionProvider.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void saveState(IMemento aMemento) {
	super.saveState(aMemento);

	if (aMemento != null) {
		int showWorkingSets = extensionStateModel
				.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0;
		aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets);

		if (workingSet != null) {
			aMemento.putString(TAG_CURRENT_WORKING_SET_NAME, workingSet.getName());
		}
	}

}
 
Example 9
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void saveState(IMemento memento) {
	if (fPagebook == null) {
		// part has not been created
		if (fMemento != null) { //Keep the old state;
			memento.putMemento(fMemento);
		}
		return;
	}
	if (fInputElements != null) {
		memento.putString(TAG_INPUT, fInputElements[0].getHandleIdentifier());
		for (int i= 1; i < fInputElements.length; i++) {
			IJavaElement element= fInputElements[i];
			memento.putString(TAG_INPUT + i, element.getHandleIdentifier());
		}
	}
	memento.putInteger(TAG_VIEW, getHierarchyMode());
	memento.putInteger(TAG_LAYOUT, getViewLayout());
	memento.putInteger(TAG_QUALIFIED_NAMES, isQualifiedTypeNamesEnabled() ? 1 : 0);
	memento.putInteger(TAG_EDITOR_LINKING, isLinkingEnabled() ? 1 : 0);

	int weigths[]= fTypeMethodsSplitter.getWeights();
	int ratio= (weigths[0] * 1000) / (weigths[0] + weigths[1]);
	memento.putInteger(TAG_RATIO, ratio);

	ScrollBar bar= getCurrentViewer().getTree().getVerticalBar();
	int position= bar != null ? bar.getSelection() : 0;
	memento.putInteger(TAG_VERTICAL_SCROLL, position);

	IJavaElement selection= (IJavaElement)((IStructuredSelection) getCurrentViewer().getSelection()).getFirstElement();
	if (selection != null) {
		memento.putString(TAG_SELECTION, selection.getHandleIdentifier());
	}

	fWorkingSetActionGroup.saveState(memento);

	fMethodsViewer.saveState(memento);
}
 
Example 10
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void saveState(IMemento memento) {
	super.saveState(memento);
	memento.putInteger(KEY_GROUPING, fCurrentGrouping);
	memento.putInteger(KEY_SORTING, fCurrentSortOrder);
	int limit= getElementLimit().intValue();
	if (limit != -1)
		memento.putString(KEY_LIMIT_ENABLED, TRUE);
	else
		memento.putString(KEY_LIMIT_ENABLED, FALSE);
	memento.putInteger(KEY_LIMIT, limit);
}
 
Example 11
Source File: InfoFactory.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public void saveState(IMemento memento) {
    if (info.info == null) {
        return;
    }
    String declaringModuleName = info.info.getDeclaringModuleName();
    if (declaringModuleName == null) {
        declaringModuleName = "";
    }
    memento.putString(TAG_MODULE_NAME, declaringModuleName);

    String path = info.info.getPath();
    if (path == null) {
        path = "";
    }
    memento.putString(TAG_PATH, path);

    String name = info.info.getName();
    if (name == null) {
        name = "";
    }
    memento.putString(TAG_NAME, name);

    memento.putString(TAG_TYPE, info.info.getType() + "");
    if (info.additionalInfo instanceof AdditionalProjectInterpreterInfo) {
        AdditionalProjectInterpreterInfo projectInterpreterInfo = (AdditionalProjectInterpreterInfo) info.additionalInfo;
        memento.putString(TAG_PROJECT_NAME, projectInterpreterInfo.getProject().getName());

    } else if (info.additionalInfo instanceof AdditionalSystemInterpreterInfo) {
        AdditionalSystemInterpreterInfo systemInterpreterInfo = (AdditionalSystemInterpreterInfo) info.additionalInfo;
        IInterpreterManager manager = systemInterpreterInfo.getManager();
        memento.putInteger(TAG_MANAGER_INTERPRETER_TYPE, manager.getInterpreterType());
        memento.putString(TAG_MANAGER_INTERPRETER, systemInterpreterInfo.getAdditionalInfoInterpreter());

    }

}
 
Example 12
Source File: IndexedJsniJavaRef.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public void save(IMemento memento) {
  // We have to make sure to call super.toString() here to use JsniRef's
  // toString(), which provides the literal text of the Java reference)
  memento.putTextData(super.toString());
  memento.putString(TAG_SOURCE, getSource().toString());
  memento.putInteger(TAG_OFFSET, getOffset());
}
 
Example 13
Source File: StatechartDefinitionSection.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void setMementoProperties(IMemento memento) {
	String sectionProperty = getSectionProperty(getContextObject());
	if (previousWidths.length >= 2) {
		memento.putInteger(sectionProperty + MEM_FIRST_WEIGHT, previousWidths[0]);
		memento.putInteger(sectionProperty + MEM_SECOND_WEIGHT, previousWidths[1]);
	}
	memento.putBoolean(sectionProperty + MEM_EXPANDED, sectionExpanded);
}
 
Example 14
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void saveLayoutState(IMemento memento) {
	if (memento != null) {
		memento.putInteger(TAG_LAYOUT, getLayoutAsInt());
		memento.putInteger(TAG_GROUP_LIBRARIES, fShowLibrariesNode ? 1 : 0);
	}
}
 
Example 15
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void saveLinkingEnabled(IMemento memento) {
	memento.putInteger(TAG_LINK_EDITOR, fLinkingEnabled ? 1 : 0);
}
 
Example 16
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void saveLinkingEnabled(IMemento memento) {
	memento.putInteger(getLinkToEditorKey(), fLinkingEnabled ? 1 : 0);
}
 
Example 17
Source File: PackagesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void saveState(IMemento memento) {
	super.saveState(memento);
	memento.putInteger(this.getViewSite().getId()+TAG_VIEW_STATE,fCurrViewState);
}
 
Example 18
Source File: JsniJavaRefParamType.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void save(IMemento memento) {
  memento.putTextData(paramTypeString);
  memento.putString(TAG_SOURCE, getSource().toString());
  memento.putInteger(TAG_OFFSET, getOffset());
}
 
Example 19
Source File: AbstractSearchIndexResultPage.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void saveState(IMemento memento) {
    super.saveState(memento);
    memento.putInteger(STORE_GROUP_WITH, this.groupWithConfiguration);
}
 
Example 20
Source File: TypeScriptSearchResultPage.java    From typescript.java with MIT License 4 votes vote down vote up
public void saveState(IMemento memento) {
	super.saveState(memento);
	memento.putInteger(KEY_SORTING, fCurrentSortOrder);
	memento.putInteger(KEY_LIMIT, getElementLimit().intValue());
}