use of org.eclipse.ui.IEditorReference in project dsl-devkit by dsldevkit.
the class EditorRegExMatcher method matches.
/**
* {@inheritDoc}
*/
public boolean matches(final Object item) {
if (item instanceof IEditorReference) {
IEditorReference ref = (IEditorReference) item;
regExMatcher.reset(ref.getName());
if (regExMatcher.matches()) {
return true;
}
}
return false;
}
use of org.eclipse.ui.IEditorReference in project soot by Sable.
the class SootDeltaVisitor method updateJimpleOutline.
// only updates after a save or Soot run
// (if editor is currently "dirty" the outline will be potenially incorrect
private void updateJimpleOutline(IFile file) {
IWorkbenchWindow activeWorkbenchWindow = SootPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null)
return;
IEditorReference[] refs = activeWorkbenchWindow.getActivePage().getEditorReferences();
for (int i = 0; i < refs.length; i++) {
if (refs[i] == null)
continue;
if (refs[i].getName() == null)
continue;
if (refs[i].getName().equals(file.getName())) {
JimpleEditor ed = (JimpleEditor) refs[i].getEditor(true).getAdapter(JimpleEditor.class);
if (ed != null) {
if (ed.getPage() != null) {
ed.getPage().getContentOutline();
ed.getPage().getViewer().setInput(ed.getPage().getContentOutline());
ed.getPage().getViewer().refresh();
ed.getPage().getViewer().expandAll();
}
}
}
}
}
use of org.eclipse.ui.IEditorReference in project eclipse-integration-commons by spring-projects.
the class DocumentFetcher method evalNonFileBufferDocuments.
/**
* @return returns a map from IFile to IDocument for all open, dirty editors.
*/
private Map<IFile, IDocument> evalNonFileBufferDocuments() {
Map<IFile, IDocument> result = new HashMap<IFile, IDocument>();
IWorkbench workbench = SearchPlugin.getDefault().getWorkbench();
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
for (int i = 0; i < windows.length; i++) {
IWorkbenchPage[] pages = windows[i].getPages();
for (int x = 0; x < pages.length; x++) {
IEditorReference[] editorRefs = pages[x].getEditorReferences();
for (int z = 0; z < editorRefs.length; z++) {
IEditorPart ep = editorRefs[z].getEditor(false);
if (ep instanceof ITextEditor && ep.isDirty()) {
// only dirty editors
evaluateTextEditor(result, ep);
}
}
}
}
return result;
}
use of org.eclipse.ui.IEditorReference in project eclipse-integration-commons by spring-projects.
the class QuickSearchContext method getOpenFiles.
private Collection<IFile> getOpenFiles() {
try {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
Collection<IFile> files = new ArrayList<IFile>();
IEditorReference[] editors = page.getEditorReferences();
if (editors != null) {
for (IEditorReference editor : editors) {
try {
IEditorInput input = editor.getEditorInput();
if (input != null) {
IFile file = (IFile) input.getAdapter(IFile.class);
if (file != null) {
files.add(file);
}
}
} catch (PartInitException e) {
// Ignore silently. See: https://issuetracker.springsource.com/browse/STS-4156
// Rationale: Whatever may be the reason we can't obtain a 'input' for the editor.
// It likely means there's no text to search in that editor, so it is safe to ignore
// without loss of functionality to the quicksearch engine.
// QuickSearchActivator.log(e);
}
}
lastOpenFiles = files;
return files;
}
}
return lastOpenFiles;
} finally {
}
}
use of org.eclipse.ui.IEditorReference in project eclipse-integration-commons by spring-projects.
the class IdeUiPlugin method start.
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
// avoid cyclic startup dependency on org.eclipse.mylyn.tasks.ui
Job startupJob = new UIJob("Spring Tool Suite Initialization") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
migrateBlogFeeds();
Display.getDefault().asyncExec(new Runnable() {
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
// prevent loading if already opened by workspace
// restore
IEditorReference[] references = window.getActivePage().getEditorReferences();
for (IEditorReference reference : references) {
if (DashboardEditorInputFactory.FACTORY_ID.equals(reference.getFactoryId())) {
return;
}
}
if (getPreferenceStore().getBoolean(IIdeUiConstants.PREF_OPEN_DASHBOARD_STARTUP)) {
// don't show if welcome page is visible
if (window.getWorkbench().getIntroManager().getIntro() != null) {
// scheduleUpdateJob();
return;
}
ShowDashboardAction showDashboard = new ShowDashboardAction();
showDashboard.init(window);
showDashboard.run(null);
return;
}
}
// scheduleUpdateJob();
}
});
return Status.OK_STATUS;
}
};
startupJob.setSystem(true);
startupJob.schedule();
}
Aggregations