当前位置: 首页>>代码示例>>Java>>正文


Java IEditorReference.getPart方法代码示例

本文整理汇总了Java中org.eclipse.ui.IEditorReference.getPart方法的典型用法代码示例。如果您正苦于以下问题:Java IEditorReference.getPart方法的具体用法?Java IEditorReference.getPart怎么用?Java IEditorReference.getPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.IEditorReference的用法示例。


在下文中一共展示了IEditorReference.getPart方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getEditorFile

import org.eclipse.ui.IEditorReference; //导入方法依赖的package包/类
private static IFile getEditorFile( IEditorReference fileRef )
{
	if ( fileRef != null )
	{
		IEditorPart part = (IEditorPart) fileRef.getPart( false );
		if ( part != null )
		{
			IEditorInput input = part.getEditorInput( );

			if ( input != null && input instanceof IFileEditorInput )
			{
				return ( (IFileEditorInput) input ).getFile( );
			}
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:ResourceCloseManagement.java

示例2: checkAndAddToEditorLists

import org.eclipse.ui.IEditorReference; //导入方法依赖的package包/类
private static void checkAndAddToEditorLists(
		List<IEditorPart> openedEditorRefs,
		List<IEditorPart> openedDirtyEditorRefs, IEditorReference fileRef )
{
	if ( fileRef != null )
	{
		IEditorPart part = (IEditorPart) fileRef.getPart( false );
		if ( part != null )
		{
			if ( part.isDirty( ) )
			{
				openedDirtyEditorRefs.add( part );
			}
			openedEditorRefs.add( part );
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:ResourceCloseManagement.java

示例3: refreshStyles

import org.eclipse.ui.IEditorReference; //导入方法依赖的package包/类
/**
 * Notify to the opened jrxml editors to refresh the styles
 * 
 * @param removedStyles name of the Styles that were updated in the cache
 */
private static void refreshStyles(HashSet<String> changedStyles){
	IWorkbenchWindow activeWorkbenchWindow = JaspersoftStudioPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow();
	if (activeWorkbenchWindow == null || activeWorkbenchWindow.getPages() == null) return;
	for(IWorkbenchPage page : activeWorkbenchWindow.getPages()){
		IEditorReference[] openEditors = page.getEditorReferences();
		for(IEditorReference editor : openEditors){
			IWorkbenchPart part = editor.getPart(false);
			if (part instanceof JrxmlEditor){
				JrxmlEditor jrxmlEditor = (JrxmlEditor)part;
				jrxmlEditor.refreshExternalStyles(changedStyles);
			}
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:ExternalStylesManager.java

示例4: switchEditor

import org.eclipse.ui.IEditorReference; //导入方法依赖的package包/类
private static void switchEditor(IWorkbenchPage activePage, boolean next)
{
	IEditorPart activeEditor = activePage.getActiveEditor();
	if (activeEditor != null)
	{
		IEditorReference[] editorReferences = activePage.getEditorReferences();
		if (editorReferences != null && editorReferences.length >= 2)
		{
			List<IEditorPart> editorsList = new LinkedList<IEditorPart>();
			for (IEditorReference editorReference : editorReferences)
			{
				IWorkbenchPart editorPart = editorReference.getPart(true);
				if (editorPart instanceof IEditorPart)
				{
					editorsList.add((IEditorPart) editorPart);
				}
			}
			int activeEditorIndex = editorsList.indexOf(activeEditor);
			int toEditorIndex = ((activeEditorIndex == -1) ? 0 : (activeEditorIndex + (next ? 1 : -1)));
			if (toEditorIndex < 0)
			{
				toEditorIndex = editorsList.size() - 1;
			}
			else if (toEditorIndex >= editorsList.size())
			{
				toEditorIndex = 0;
			}
			activePage.activate(editorsList.get(toEditorIndex));
		}
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:32,代码来源:NextEditorHandler.java

示例5: propertyChange

import org.eclipse.ui.IEditorReference; //导入方法依赖的package包/类
@Override
public void propertyChange(final PropertyChangeEvent evt) {
	
	Display.getDefault().asyncExec(new Runnable() {
		public void run() {
			resourceChanged(evt);
		};
	});

	// When non GUI thread => WorkbenchWidow == null
             if (Display.getDefault().getThread() != Thread.currentThread()) return;
	//IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	
	IEditorReference[] editors = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
									.getActivePage().getEditorReferences();

	for(IEditorReference er : editors){
		IWorkbenchPart part = er.getPart(false);
		if(part instanceof IEditorPart){
			IEditorPart editorPart = (IEditorPart)part;
			IDirtyAdapter dirtyAdapter = (IDirtyAdapter)editorPart.getAdapter(IDirtyAdapter.class);
			if(dirtyAdapter != null){
				dirtyAdapter.fireDirtyState();
			}
		}
	}
	
	/*
	if(editor != null){
		IDirtyAdapter dirtyAdapter = (IDirtyAdapter)editor.getAdapter(IDirtyAdapter.class);
		if(dirtyAdapter != null){
			dirtyAdapter.fireDirtyState();
		}
	}
	*/
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:37,代码来源:AbstractSidebarEditor.java

示例6: doRun

import org.eclipse.ui.IEditorReference; //导入方法依赖的package包/类
@Override
protected void doRun(final IAction action) {
    final QueryHierarchy queryHierarchy = getQueryHierarchy();
    final QueryItem queryItem = selectedQueryItem;

    final SetQueryItemNameDialog nameDialog = new SetQueryItemNameDialog(getShell());
    nameDialog.setOriginalName(queryItem.getName());
    nameDialog.setParent(queryItem.getParent());

    if (nameDialog.open() != IDialogConstants.OK_ID) {
        return;
    }

    try {
        queryItem.setName(nameDialog.getName());
        queryHierarchy.save();

        /*
         * Update any open editors if this is a query.
         */
        if (queryItem instanceof QueryDefinition) {
            final QueryDefinition queryDefinition = (QueryDefinition) queryItem;
            final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

            for (final IEditorReference editorReference : page.getEditorReferences()) {
                final IWorkbenchPart part = editorReference.getPart(false);
                if (part instanceof BaseQueryDocumentEditor) {
                    final BaseQueryDocumentEditor baseQueryDocumentEditor = (BaseQueryDocumentEditor) part;
                    final QueryDocument queryDocument = baseQueryDocumentEditor.getQueryDocument();

                    if (queryDefinition.getID().equals(queryDocument.getGUID())) {
                        baseQueryDocumentEditor.onQueryDocumentRenamed(queryDefinition.getName());
                    }
                }
            }
        }
    } catch (final Exception e) {
        queryHierarchy.reset();

        final String messageFormat = Messages.getString("RenameQueryItemAction.ErrorDialogTextFormat"); //$NON-NLS-1$
        final String message = MessageFormat.format(messageFormat, e.getLocalizedMessage());
        MessageDialog.openError(getShell(), Messages.getString("RenameQueryItemAction.ErrorDialogTitle"), message); //$NON-NLS-1$
        return;
    }

    final QueryItemEventArg queryItemArg = new QueryItemEventArg(queryItem);
    getContext().getEvents().notifyListener(TeamExplorerEvents.QUERY_ITEM_RENAMED, queryItemArg);

    final QueryFolderEventArg queryFolderArg = new QueryFolderEventArg(queryItem.getParent());
    getContext().getEvents().notifyListener(TeamExplorerEvents.QUERY_FOLDER_CHILDREN_UPDATED, queryFolderArg);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:52,代码来源:RenameQueryItemAction.java


注:本文中的org.eclipse.ui.IEditorReference.getPart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。