本文整理汇总了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;
}
示例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 );
}
}
}
示例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);
}
}
}
}
示例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));
}
}
}
示例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();
}
}
*/
}
示例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);
}