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

The following examples show how to use org.eclipse.ui.IMemento#getInteger() . 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: JsniJavaRefParamType.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public static JsniJavaRefParamType load(IMemento memento) {
  // Extract the string representing the reference itself
  String refString = memento.getTextData();
  if (refString == null) {
    return null;
  }

  // Set the source property (the file containing the reference)
  String sourceString = memento.getString(TAG_SOURCE);
  if (sourceString == null) {
    return null;
  }

  // Set the offset property (the location within the containing file)
  Integer offset = memento.getInteger(TAG_OFFSET);
  if (offset == null) {
    return null;
  }

  // Parse the reference string into an actual JsniJavaRefParamType
  return JsniJavaRefParamType.parse(new Path(sourceString),
      offset.intValue(), refString);
}
 
Example 2
Source File: SearchScopeActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void restoreState(IMemento memento) {
	String[] workingSetNames= null;
	Integer scopeType= memento.getInteger(TAG_SEARCH_SCOPE_TYPE);
	if (scopeType != null) {
		if (scopeType.intValue() == SEARCH_SCOPE_TYPE_WORKING_SET) {
			Integer workingSetCount= memento.getInteger(TAG_WORKING_SET_COUNT);
			if (workingSetCount != null) {
				workingSetNames = new String[workingSetCount.intValue()];
				for (int i = 0; i < workingSetCount.intValue(); i++) {
					workingSetNames[i]= memento.getString(TAG_SELECTED_WORKING_SET+i);
				}
			}
		}
		setSelected(getSearchScopeAction(scopeType.intValue(), workingSetNames), false);
	}
}
 
Example 3
Source File: MethodsViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Restores the state of the filter actions
 * @param memento the memento
 */
public void restoreState(IMemento memento) {
	fMemberFilterActionGroup.restoreState(memento);
	getControl().setRedraw(false);
	refresh();
	getControl().setRedraw(true);

	boolean showInherited= Boolean.valueOf(memento.getString(TAG_SHOWINHERITED)).booleanValue();
	showInheritedMethods(showInherited);

	boolean showDefiningTypes= Boolean.valueOf(memento.getString(TAG_SORTBYDEFININGTYPE)).booleanValue();
	sortByDefiningType(showDefiningTypes);

	ScrollBar bar= getTable().getVerticalBar();
	if (bar != null) {
		Integer vScroll= memento.getInteger(TAG_VERTICAL_SCROLL);
		if (vScroll != null) {
			bar.setSelection(vScroll.intValue());
		}
	}
}
 
Example 4
Source File: JavaNavigatorViewActionProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void restoreState(IMemento memento) {
	boolean isCurrentLayoutFlat= true;
	Integer state= null;
	if (memento != null)
		state= memento.getInteger(TAG_LAYOUT);

	// If no memento try an restore from preference store
	if (state == null) {
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		state= new Integer(store.getInt(TAG_LAYOUT));
	}

	if (state.intValue() == FLAT_LAYOUT)
		isCurrentLayoutFlat= true;
	else
		if (state.intValue() == HIERARCHICAL_LAYOUT)
			isCurrentLayoutFlat= false;

	fStateModel.setBooleanProperty(Values.IS_LAYOUT_FLAT, isCurrentLayoutFlat);
	fLayoutActionGroup.setFlatLayout(isCurrentLayoutFlat);
}
 
Example 5
Source File: TestResultsView.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void restoreLayoutState(IMemento memento) {
	Integer ratio = memento.getInteger(TAG_RATIO);
	if (ratio != null) {
		sashForm.setWeights(new int[] { ratio.intValue(), 1000 - ratio.intValue() });
	}
	Integer orientation = memento.getInteger(TAG_ORIENTATION);
	if (orientation != null) {
		viewLayoutHelper.setOrientation(orientation.intValue());
	}
	Integer filter = memento.getInteger(TAG_SHOW_FILTER);
	if (filter != null) {
		viewFilterHelper.setFilter(filter);
	}
	Boolean scrollLock = memento.getBoolean(TAG_SCROLL);
	if (scrollLock != null) {
		actionScrollLock.setChecked(scrollLock);
	}
	Boolean testHover = memento.getBoolean(TAG_TEST_HOVER);
	if (testHover != null) {
		actionShowTestHover.setChecked(testHover);
	}
	Boolean omitCommonPrefix = memento.getBoolean(TAG_OMIT_COMMON_PREFIX);
	if (omitCommonPrefix != null) {
		actionOmitCommonPrefix.setChecked(omitCommonPrefix);
	}

}
 
Example 6
Source File: RealTimeListViewer.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public void loadFrom ( final IMemento memento )
{
    if ( memento == null )
    {
        return;
    }

    try
    {
        {
            this.initialColWidth = new LinkedList<Integer> ();
            final IMemento tableMemento = memento.getChild ( "tableCols" ); //$NON-NLS-1$
            if ( tableMemento != null )
            {
                int i = 0;
                Integer w;
                while ( ( w = tableMemento.getInteger ( "col_" + i ) ) != null ) //$NON-NLS-1$
                {
                    this.initialColWidth.add ( w );
                    i++;
                }
            }
        }

        for ( final IMemento child : memento.getChildren ( "item" ) ) //$NON-NLS-1$
        {
            final Item item = Item.loadFrom ( child );
            if ( item != null )
            {
                this.list.add ( item );
            }
        }
    }
    catch ( final Exception e )
    {
        Activator.getDefault ().getLog ().log ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.RealTimeListViewer_ErrorLoadingData, e ) );
    }
}
 
Example 7
Source File: StatechartDefinitionSection.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected int[] getWeightProperties(IMemento memento) {
	String sectionProperty = getSectionProperty(getContextObject());
	Integer first = memento.getInteger(sectionProperty + MEM_FIRST_WEIGHT);
	Integer second = memento.getInteger(sectionProperty + MEM_SECOND_WEIGHT);
	if (first != null && second != null)
		return new int[] { first, second };
	return DEFAULT_WEIGHTS;
}
 
Example 8
Source File: IndexedJsniJavaRef.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public static IndexedJsniJavaRef load(IMemento memento) {
  // Extract the string representing the reference itself
  String refString = memento.getTextData();
  if (refString == null) {
    return null;
  }

  // Parse the reference string into an actual JsniJavaRef
  JsniJavaRef ref = JsniJavaRef.parse(refString);
  if (ref == null) {
    return null;
  }

  // Set the source property (the file containing the reference)
  String sourceString = memento.getString(TAG_SOURCE);
  if (sourceString == null) {
    return null;
  } else {
    ref.setSource(new Path(sourceString));
  }

  // Set the offset property (the location within the containing file)
  Integer offset = memento.getInteger(TAG_OFFSET);
  if (offset == null) {
    return null;
  } else {
    ref.setOffset(offset.intValue());
  }

  return new IndexedJsniJavaRef(ref);
}
 
Example 9
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void restoreLayoutState(IMemento memento) {
	Integer layoutState= memento.getInteger(TAG_LAYOUT);
	fIsCurrentLayoutFlat= layoutState == null || layoutState.intValue() == FLAT_LAYOUT;

	// on by default
	Integer groupLibraries= memento.getInteger(TAG_GROUP_LIBRARIES);
	fShowLibrariesNode= groupLibraries == null || groupLibraries.intValue() != 0;
}
 
Example 10
Source File: PackagesView.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void restoreLayoutState(IMemento memento) {
	if (memento == null) {
		//read state from the preference store
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		fCurrViewState= store.getInt(this.getViewSite().getId() + TAG_VIEW_STATE);
	} else {
		//restore from memento
		Integer integer= memento.getInteger(this.getViewSite().getId() + TAG_VIEW_STATE);
		if ((integer == null) || !isValidState(integer.intValue())) {
			fCurrViewState= LIST_VIEW_STATE;
		} else fCurrViewState= integer.intValue();
	}
}
 
Example 11
Source File: AbstractSearchIndexResultPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void restoreState(IMemento memento) {
    super.restoreState(memento);
    if (memento != null) {
        Integer value = memento.getInteger(STORE_GROUP_WITH);
        if (value != null) {
            groupWithConfiguration = value.intValue();
            updateGroupWith(this.getViewer());
        }
        for (GroupByAction act : this.fGroupByActions) {
            act.updateImage();
        }
    }
}
 
Example 12
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void restoreRootMode(IMemento memento) {
	Integer value= memento.getInteger(TAG_ROOT_MODE);
	fRootMode= value == null ? PROJECTS_AS_ROOTS : value.intValue();
	if (fRootMode != PROJECTS_AS_ROOTS && fRootMode != WORKING_SETS_AS_ROOTS)
		fRootMode= PROJECTS_AS_ROOTS;
}
 
Example 13
Source File: PackageExplorerPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void restoreLinkingEnabled(IMemento memento) {
	Integer val= memento.getInteger(TAG_LINK_EDITOR);
	fLinkingEnabled= val != null && val.intValue() != 0;
}
 
Example 14
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Restores the state of the type hierarchy view from the memento.
 * 
 * @param memento the memento
 * @param input the input java elements
 * @since 3.7
 */
final void doRestoreState(IMemento memento, IJavaElement[] input) {
	synchronized (this) {
		if (fRestoreStateJob == null) {
			return;
		}
		fRestoreStateJob= null;
	}

	fWorkingSetActionGroup.restoreState(memento);
	setKeepShowingEmptyViewers(false);
	setInputElements(input);

	Integer viewerIndex= memento.getInteger(TAG_VIEW);
	if (viewerIndex != null) {
		setHierarchyMode(viewerIndex.intValue());
	}
	Integer layout= memento.getInteger(TAG_LAYOUT);
	if (layout != null) {
		setViewLayout(layout.intValue());
	}

	Integer val= memento.getInteger(TAG_EDITOR_LINKING);
	if (val != null) {
		setLinkingEnabled(val.intValue() != 0);
	}

	Integer showQualified= memento.getInteger(TAG_QUALIFIED_NAMES);
	if (showQualified != null) {
		showQualifiedTypeNames(showQualified.intValue() != 0);
	}

	updateCheckedState();

	Integer ratio= memento.getInteger(TAG_RATIO);
	if (ratio != null) {
		fTypeMethodsSplitter.setWeights(new int[] { ratio.intValue(), 1000 - ratio.intValue() });
	}
	ScrollBar bar= getCurrentViewer().getTree().getVerticalBar();
	if (bar != null) {
		Integer vScroll= memento.getInteger(TAG_VERTICAL_SCROLL);
		if (vScroll != null) {
			bar.setSelection(vScroll.intValue());
		}
	}
	fMethodsViewer.restoreState(memento);
}
 
Example 15
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void restoreLinkingEnabled(IMemento memento) {
	Integer val= memento.getInteger(getLinkToEditorKey());
	if (val != null) {
		fLinkingEnabled= val.intValue() != 0;
	}
}