當前位置: 首頁>>代碼示例>>Java>>正文


Java IMemento.getString方法代碼示例

本文整理匯總了Java中org.eclipse.ui.IMemento.getString方法的典型用法代碼示例。如果您正苦於以下問題:Java IMemento.getString方法的具體用法?Java IMemento.getString怎麽用?Java IMemento.getString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.IMemento的用法示例。


在下文中一共展示了IMemento.getString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void init ( final IViewSite site, final IMemento memento ) throws PartInitException
{
    if ( memento != null )
    {
        this.connectionId = memento.getString ( CONNECTION_ID );
        this.connectionUri = memento.getString ( CONNECTION_URI );
    }

    super.init ( site, memento );
    try
    {
        // it is OK to fail at this stage
        reInitializeConnection ( this.connectionId, this.connectionUri );
    }
    catch ( final Exception e )
    {
        logger.warn ( "init () - couldn't recreate connection", e ); //$NON-NLS-1$
        // just reset all values
        this.connectionId = null;
        this.connectionUri = null;
        this.connectionService = null;
        this.connectionTracker = null;
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:AbstractAlarmsEventsView.java

示例2: createElement

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public IAdaptable createElement(IMemento memento) {
	String uriStr = memento.getString(EMF_URI);
	if (uriStr == null) {
		return null;
	}
	URI uri = URI.createURI(uriStr);
	ResourceSet resourceSet = DiagramPartitioningUtil.getSharedDomain().getResourceSet();
	Resource resource = resourceSet.getResource(uri, false);
	if (resource == null)
		resource = resourceSet.createResource(uri);
	try {
		resource.load(Collections.emptyMap());
	} catch (IOException e) {
		e.printStackTrace();
	}
	Diagram diagram = (Diagram) resource.getEObject(uri.fragment());
	return new DiagramEditorInput(diagram);
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:19,代碼來源:DiagramEditorInputFactory.java

示例3: save

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
 * Associate projects with branch. The specified memento must the one
 * previously returned from a call to {@link #snapshot()}.
 *
 * @see #snapshot()
 * @param memento
 * @return this tracker
 */
public BranchProjectTracker save(final IMemento memento) {
	if (!(memento instanceof XMLMemento))
		throw new IllegalArgumentException("Invalid memento"); //$NON-NLS-1$

	String branch = memento.getString(KEY_BRANCH);
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	String pref = getPreference(branch);
	StringWriter writer = new StringWriter();
	try {
		((XMLMemento) memento).save(writer);
		store.setValue(pref, writer.toString());
	} catch (IOException e) {
		Activator.logError("Error writing branch-project associations", e); //$NON-NLS-1$
	}
	return this;
}
 
開發者ID:Genuitec,項目名稱:gerrit-tools,代碼行數:25,代碼來源:BranchProjectTracker.java

示例4: restoreState

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private void restoreState() {
	if (memento == null)
		return;
	IMemento m = memento.getChild(ID);
	if(m == null)
		return;

	int objHash = CastUtil.cint(m.getInteger("objHash"));
	String objName = m.getString("objName");
	String objType = m.getString("objType");
	String counter = m.getString("counter");
	int serverId = CastUtil.cint(m.getInteger("serverId"));
	try {
		setInput(objHash, objName, objType, counter, serverId);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:19,代碼來源:CounterRealDateView.java

示例5: restoreState

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private void restoreState() {
	if (memento == null)
		return;
	IMemento m = memento.getChild(ID);

	int objHash = CastUtil.cint(m.getInteger("objHash"));
	String objName = m.getString("objName");
	String objType = m.getString("objType");
	String counter = m.getString("counter");
	int serverId = CastUtil.cint(m.getInteger("serverId"));
	try {
		setInput(objHash, objName, objType, counter, serverId);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:scouter-project,項目名稱:scouter,代碼行數:17,代碼來源:CounterRealTimeView.java

示例6: restoreItemFromMemento

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
protected Object restoreItemFromMemento(final IMemento memento) {
	final String uri = memento.getString(MEMENTO_URI_KEY);
	if (!isNullOrEmpty(uri)) {
		final Optional<IEObjectDescription> result = tryFind(indexSupplier.get().getExportedObjects(),
				desc -> uri.equals(String.valueOf(desc.getEObjectURI())));
		if (result.isPresent()) {
			return searchKind.matches(result.get().getEClass()) ? result.get() : null;
		}
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:13,代碼來源:OpenTypeSelectionDialog.java

示例7: init

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void init ( final IViewSite site, final IMemento memento ) throws PartInitException
{
    super.init ( site, memento );

    if ( memento != null )
    {
        final String s = memento.getString ( "columnSettings" ); //$NON-NLS-1$
        if ( s != null )
        {
            this.initialColumnSettings = this.gson.fromJson ( s, new TypeToken<List<ColumnProperties>> () {}.getType () );
        }
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:15,代碼來源:EventPoolView.java

示例8: loadFrom

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
public static Item loadFrom ( final IMemento memento )
{
    if ( memento == null )
    {
        return null;
    }

    final String itemId = memento.getString ( "item.id" );
    final String connectionUri = memento.getString ( "connection.uri" );
    final String typeStr = memento.getString ( "type" );
    final Type type;

    if ( typeStr != null )
    {
        type = Type.valueOf ( typeStr );
    }
    else
    {
        type = Type.URI;
    }

    if ( itemId == null || connectionUri == null || type == null )
    {
        return null;
    }
    else
    {
        return new Item ( connectionUri, itemId, type );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:31,代碼來源:Item.java

示例9: createElement

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public IAdaptable createElement(IMemento memento) {
    String projName = memento.getString(TAG_PROJECT);
    ProjectEditorInput input = new ProjectEditorInput(projName);

    IProject project =
            (projName == null) ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(projName);
    if (project == null || !project.exists() || !project.isOpen()) {
        input.setError(new PgCodekeeperUIException(Messages.project_either_closed_or_deleted + projName));
    }

    return input;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:14,代碼來源:ProjectEditorInputFactory.java

示例10: setResources

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
/**
 * Restores the resources that were previously saved from a saveState().
 * This will usually be called when opening a previously pinned sync view.
 *
 * @param settings
 *        The IMemento to restore from
 */
private void setResources(final IMemento settings) {
    Check.notNull(settings, "settings"); //$NON-NLS-1$

    final List<IResource> resourceList = new ArrayList<IResource>();
    final String resourcePathList = settings.getString(PARTICIPANT_SETTINGS_RESOURCES);

    if (resourcePathList == null) {
        return;
    }

    final String[] resourcePaths = resourcePathList.split("\\|"); //$NON-NLS-1$

    for (int i = 0; i < resourcePaths.length; i++) {
        ResourceType resourceType = ResourceType.FILE;

        if (resourcePaths[i].endsWith("/")) //$NON-NLS-1$
        {
            resourceType = ResourceType.CONTAINER;
        }

        final IResource resource = Resources.getResourceForLocation(resourcePaths[i], resourceType);

        if (resource != null) {
            resourceList.add(resource);
        }
    }

    setResources(resourceList.toArray(new IResource[resourceList.size()]));
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:37,代碼來源:SynchronizeParticipant.java

示例11: getEnum

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private <T extends Enum<T>> T getEnum(IMemento memento, String key,
    Class<T> type, T preset) {
  if (memento == null) {
    return preset;
  }
  final String s = memento.getString(key);
  if (s == null) {
    return preset;
  }
  try {
    return Enum.valueOf(type, s);
  } catch (IllegalArgumentException e) {
    return preset;
  }
}
 
開發者ID:eclipse,項目名稱:eclemma,代碼行數:16,代碼來源:ViewSettings.java

示例12: init

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
	super.init(site);
	if (memento != null) {
		String u = memento.getString(IBrowserConstants.MEMENTO_URL);
		if (u != null) {
			initialUrl = u;
		}
	}
}
 
開發者ID:NineWorlds,項目名稱:xstreamer,代碼行數:11,代碼來源:BrowserView.java

示例13: loadExpandedElements

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private Object[] loadExpandedElements(BookmarksTree bookmarksTree, IMemento memento) {
	if (memento == null) {
		return new Object[0];
	}
	String expandedElementsStr = memento.getString(STORE_EXPANDED);
	if (expandedElementsStr == null) {
		return new Object[0];
	}
	String[] ids = expandedElementsStr.split(",");
	return Arrays.stream(ids).map(id -> bookmarksTree.getBookmark(new BookmarkId(id)))
			.filter(bookmark -> bookmark != null).toArray(size -> new Object[size]);
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:13,代碼來源:BookmarksTreeViewerStateManager.java

示例14: loadSelectedElement

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
private ISelection loadSelectedElement(BookmarksTree bookmarksTree, IMemento memento) {
	if (memento == null) {
		return new StructuredSelection();
	}
	String selectedIdStr = memento.getString(STORE_SELECTED);
	if (selectedIdStr == null) {
		return new StructuredSelection();
	}
	Bookmark bookmark = bookmarksTree.getBookmark(new BookmarkId(selectedIdStr));
	if (bookmark == null) {
		return new StructuredSelection();
	}
	return new StructuredSelection(bookmark);
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:15,代碼來源:BookmarksTreeViewerStateManager.java

示例15: restoreState

import org.eclipse.ui.IMemento; //導入方法依賴的package包/類
@Override
public void restoreState(IMemento memento) {
	userName = memento.getString(ModelExplorer.USERNAME);
	passWord = memento.getString(ModelExplorer.PASSWORD);
	repository = memento.getString(ModelExplorer.REPOSITORY);

	try {
		storageAccess = StorageAccessFactory.createStorageAccess(userName, passWord, repository);
		RWT.getUISession().setAttribute(ModelExplorer.STORAGEACCESS, storageAccess);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:mondo-project,項目名稱:mondo-demo-wt,代碼行數:14,代碼來源:WTSpec4MEditor.java


注:本文中的org.eclipse.ui.IMemento.getString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。