本文整理匯總了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);
}