use of org.eclipse.ui.IWorkbenchPartSite in project tmdm-studio-se by Talend.
the class RenameViewAction method getRenameDialog.
private RenameViewDialog getRenameDialog(String oldName) {
RenameViewDialog dialog = null;
IWorkbenchPartSite site = commonViewer.getCommonNavigator().getSite();
if (RepositoryTransformUtil.getInstance().getViewType(oldName) == TYPE_WEBFILTER) {
dialog = new RenameViewDialog(getShell(), Messages.RenameObjectAction_rename, Messages.Common_rename, oldName.substring(PREFIX_VIEW_UPPER.length()), getInputValidator(), site);
} else {
dialog = new RenameViewDialog2(getShell(), Messages.RenameObjectAction_rename, Messages.Common_rename, oldName, getInputValidator(), site);
}
return dialog;
}
use of org.eclipse.ui.IWorkbenchPartSite in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method displayFeeds.
private void displayFeeds(final Composite composite, final ScrolledComposite scrolled, final PageBook pagebook, final Control disclaimer, Map<String, String> map, String feedName, final Section section) {
final AggregateFeedJob job = new AggregateFeedJob(map, feedName);
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
unfinishedJobs.remove(job);
IWorkbenchPartSite site = getSite();
if (site != null && site.getShell() != null && !site.getShell().isDisposed() && site.getShell().getDisplay() != null && !site.getShell().getDisplay().isDisposed()) {
site.getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
Map<SyndEntry, SyndFeed> entryToFeed = job.getFeedReader().getFeedsWithEntries();
Set<SyndEntry> entries = entryToFeed.keySet();
if (!getManagedForm().getForm().isDisposed()) {
displayFeeds(entries, composite, scrolled, pagebook, disclaimer, section);
}
}
});
}
}
});
unfinishedJobs.add(job);
job.schedule();
}
use of org.eclipse.ui.IWorkbenchPartSite in project webtools.sourceediting by eclipse.
the class XMLTableTreeActionBarContributor method setActiveEditor.
public void setActiveEditor(IEditorPart targetEditor) {
editorPart = targetEditor;
// IStructuredModel model = getModelForEditorPart(targetEditor);
/* reloadGrammarAction.setModel(model);
toggleAction.setModelQuery(ModelQueryUtil.getModelQuery(model));
XMLTableTreeViewer tableTreeViewer = getTableTreeViewerForEditorPart(editorPart);
if (tableTreeViewer != null) {
expandAction.setViewer(tableTreeViewer);
collapseAction.setViewer(tableTreeViewer);
xmlMenuExpandAction.setViewer(tableTreeViewer);
xmlMenuCollapseAction.setViewer(tableTreeViewer);
}
*/
ITextEditor textEditor = null;
if (editorPart instanceof XMLMultiPageEditorPart) {
IWorkbenchPartSite site = editorPart.getSite();
if (site instanceof IEditorSite) {
textEditor = ((XMLMultiPageEditorPart) editorPart).getTextEditor();
}
}
actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, getAction(textEditor, ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, getAction(textEditor, ITextEditorActionConstants.REDO));
// TODO... uncomment this and investigate NPE
//
// add the cut/copy/paste for text fields
// ActionHandlerPlugin.connectPart(editorPart);
}
use of org.eclipse.ui.IWorkbenchPartSite in project webtools.sourceediting by eclipse.
the class XSDRefactorGroupActionDelegate method fillMenu.
/**
* Fills the menu with applicable refactor sub-menues
* @param menu The menu to fill
*/
protected void fillMenu(Menu menu) {
if (fSelection == null) {
return;
}
if (workbenchPart != null) {
IWorkbenchPartSite site = workbenchPart.getSite();
if (site == null)
return;
IEditorPart editor = site.getPage().getActiveEditor();
if (editor != null) {
XSDSchema schema = (XSDSchema) editor.getAdapter(XSDSchema.class);
ISelectionMapper mapper = (ISelectionMapper) editor.getAdapter(ISelectionMapper.class);
if (schema != null) {
ISelection selection = mapper != null ? mapper.mapSelection(fSelection) : fSelection;
RefactorActionGroup refactorMenuGroup = new XSDRefactorActionGroup(selection, schema);
RefactorGroupSubMenu subMenu = new RefactorGroupSubMenu(refactorMenuGroup);
subMenu.fill(menu, -1);
}
}
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project liferay-ide by liferay.
the class AbstractKaleoEditorHelper method openEditor.
public void openEditor(ISapphirePart sapphirePart, Element modelElement, ValueProperty valueProperty) {
try {
Object content = modelElement.property(valueProperty).content();
if (content == null) {
content = "";
}
IProject project = sapphirePart.adapt(IProject.class);
IEditorInput editorInput = modelElement.adapt(IEditorInput.class);
String name = editorInput.getName();
Node node = modelElement.nearest(Node.class);
String nodeName = node.getName().content();
HiddenFileEditorInput hiddenFileEditorInput = _getHiddenFileEditorInput(project, name, nodeName, content.toString());
IEditorSite editorSite = sapphirePart.adapt(IEditorSite.class);
IWorkbenchWindow wbWindow = editorSite.getWorkbenchWindow();
IEditorPart editorPart = wbWindow.getActivePage().openEditor(hiddenFileEditorInput, _editorId);
ITextEditor textEditor = (ITextEditor) editorPart.getAdapter(ITextEditor.class);
IDocumentListener documentListener = new IDocumentListener() {
public void documentAboutToBeChanged(DocumentEvent event) {
}
public void documentChanged(DocumentEvent event) {
String contents = event.getDocument().get();
modelElement.property(valueProperty).write(contents);
}
};
IDocumentProvider documentProvider = textEditor.getDocumentProvider();
documentProvider.getDocument(hiddenFileEditorInput).addDocumentListener(documentListener);
IWorkbenchPartSite wbPartSite = editorPart.getSite();
IPartListener partListener = new IPartListener() {
public void partActivated(IWorkbenchPart part) {
}
public void partBroughtToTop(IWorkbenchPart part) {
}
public void partClosed(IWorkbenchPart part) {
if ((part != null) && part.equals(editorPart)) {
new WorkspaceJob("delete temp editor file") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
try {
IFile file = hiddenFileEditorInput.getFile();
file.getParent().delete(true, null);
} catch (CoreException ce) {
}
return Status.OK_STATUS;
}
}.schedule(100);
}
}
public void partDeactivated(IWorkbenchPart part) {
}
public void partOpened(IWorkbenchPart part) {
}
};
wbPartSite.getPage().addPartListener(partListener);
} catch (Exception e) {
KaleoUI.logError("Error opening editor.", e);
}
}
Aggregations