use of org.eclipse.ui.IActionBars in project tdi-studio-se by Talend.
the class TalendPaletteHelper method checkAndInitToolBar2.
private static void checkAndInitToolBar2() {
//
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null || activeWorkbenchWindow.getActivePage() == null) {
return;
}
boolean isTalendEditor = false;
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
IEditorPart activePart = activePage.getActiveEditor();
if (activePart != null && activePart instanceof AbstractMultiPageTalendEditor) {
isTalendEditor = true;
}
IViewPart paletteViewPart = activePage.findView(PaletteView.ID);
if (paletteViewPart != null) {
// find existing or not, and add it.
IActionBars actionBars = paletteViewPart.getViewSite().getActionBars();
// ShowStandardAction showStandardAction = ShowStandardAction.getInstance();
// updatePaletteActions(actionBars, showStandardAction, isTalendEditor);
//
// ShowFavoriteAction showFavoriteAction = ShowFavoriteAction.getInstance();
// updatePaletteActions(actionBars, showFavoriteAction, isTalendEditor);
//
// if (ShowFavoriteAction.state) {
// showStandardAction.doSetEnable();
// }
OpenPaletteFilterAction openPaletteFilterAction = OpenPaletteFilterAction.getInstance();
updatePaletteActions(actionBars, openPaletteFilterAction, isTalendEditor);
actionBars.updateActionBars();
}
}
use of org.eclipse.ui.IActionBars in project tesb-studio-se by Talend.
the class ESBRuntimeConsolePageParticipant method init.
@Override
public void init(IPageBookViewPage page, IConsole console) {
if (page.getControl() instanceof StyledText) {
StyledText viewer = (StyledText) page.getControl();
AnsiConsoleStyleListener myListener = new AnsiConsoleStyleListener();
viewer.addLineStyleListener(myListener);
ESBRunContainerPlugin.getDefault().addViewer(viewer, this);
}
startRuntimeAction = new StartRuntimeAction(true, page.getControl().getShell());
haltRuntimeAction = new StopRuntimeAction(page.getControl().getShell());
openRuntimeInfoAction = new OpenRuntimeInfoAction();
openRuntimePrefsAction = new OpenRuntimePrefsAction();
serverListener = new RuntimeStatusChangeListener() {
@Override
public void stopRunning() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
startRuntimeAction.setEnabled(true);
haltRuntimeAction.setEnabled(false);
openRuntimeInfoAction.setEnabled(false);
}
});
}
@Override
public void startRunning() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
startRuntimeAction.setEnabled(false);
haltRuntimeAction.setEnabled(true);
openRuntimeInfoAction.setEnabled(true);
}
});
}
@Override
public void featureUninstalled(int id) {
}
@Override
public void featureInstalled(int id) {
}
};
RuntimeServerController.getInstance().addStatusChangeListener(serverListener);
IActionBars actionBars = page.getSite().getActionBars();
configureToolBar(actionBars.getToolBarManager());
}
use of org.eclipse.ui.IActionBars in project tdi-studio-se by Talend.
the class CpuDumpEditor method contributeToActionBars.
/**
* Contributes to action bars.
*/
private void contributeToActionBars() {
IActionBars actionBars = getEditorSite().getActionBars();
actionBars.setGlobalActionHandler(JdtActionConstants.OPEN, new OpenDeclarationAction());
actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), new FindAction());
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), new CopyAction());
}
use of org.eclipse.ui.IActionBars in project bndtools by bndtools.
the class JAREditorContributor method setActivePage.
/*
* (non-JavaDoc) Method declared in AbstractMultiPageEditorActionBarContributor.
*/
@Override
public void setActivePage(IEditorPart part) {
if (activeEditorPart == part)
return;
activeEditorPart = part;
IActionBars actionBars = getActionBars();
if (actionBars != null) {
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), getAction(editor, ITextEditorActionConstants.DELETE));
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), getAction(editor, ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), getAction(editor, ITextEditorActionConstants.REDO));
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), getAction(editor, ITextEditorActionConstants.CUT));
actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), getAction(editor, ITextEditorActionConstants.COPY));
actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), getAction(editor, ITextEditorActionConstants.PASTE));
actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), getAction(editor, ITextEditorActionConstants.SELECT_ALL));
actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), getAction(editor, ITextEditorActionConstants.FIND));
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), getAction(editor, IDEActionFactory.BOOKMARK.getId()));
actionBars.updateActionBars();
}
}
use of org.eclipse.ui.IActionBars in project eclipse.platform.text by eclipse.
the class AbstractTextEditor method registerUndoRedoAction.
/**
* Registers the given undo/redo action under the given ID and ensures that previously installed
* actions get disposed. It also takes care of re-registering the new action with the global
* action handler.
*
* @param actionId the action id under which to register the action
* @param action the action to register or <code>null</code> to dispose them
* @since 3.1
*/
private void registerUndoRedoAction(String actionId, OperationHistoryActionHandler action) {
IAction oldAction = getAction(actionId);
if (oldAction instanceof OperationHistoryActionHandler)
((OperationHistoryActionHandler) oldAction).dispose();
if (action == null)
return;
setAction(actionId, action);
IActionBars actionBars = getEditorSite().getActionBars();
if (actionBars != null)
actionBars.setGlobalActionHandler(actionId, action);
}
Aggregations