當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。