use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.
the class DesignerCoreService method getCurrentProcess.
// ends.
/*
* (non-Javadoc)
*
* @see org.talend.designer.core.IDesignerCoreService#getCurrentProcess()
*/
@Override
public IProcess getCurrentProcess() {
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (!(editor instanceof AbstractMultiPageTalendEditor)) {
return null;
}
IProcess process = ((AbstractMultiPageTalendEditor) editor).getProcess();
return process;
}
use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.
the class StatsAndLogsComposite method useProjectSettingButtonClick.
/*
* (non-Javadoc)
*
* @see org.talend.designer.core.ui.views.jobsettings.AbstractPreferenceComposite#useProjectSettingButtonClick()
*/
@Override
protected void useProjectSettingButtonClick() {
boolean flag = useProjectSetting.getSelection();
setMainCompositeEnable(!flag);
topComposite.setEnabled(true);
ElementParameter2ParameterType.setParameterValue(pType, EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getName(), Boolean.valueOf(flag));
PropertyChangeCommand cmd = new PropertyChangeCommand(elem, EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getName(), Boolean.valueOf(flag));
getCommandStack().execute(cmd);
updateContextValue(flag);
// hywang add for bug 7587
IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
AbstractTalendEditor workbenchPart = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
Boolean currentEditorDirty = workbenchPart.isDirty();
if (!currentEditorDirty) {
workbenchPart.setDirty(true);
}
}
if (flag) {
useProjectSetting();
}
}
use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.
the class SQLPatternComposite method executeCommand.
/**
* yzhang Comment method "executeCommand".
*
* @param cmd
*/
private void executeCommand(Command cmd) {
if (commandStack == null) {
IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if (part instanceof AbstractMultiPageTalendEditor) {
AbstractTalendEditor editor = ((AbstractMultiPageTalendEditor) part).getTalendEditor();
commandStack = (CommandStack) editor.getAdapter(CommandStack.class);
}
}
if (commandStack == null) {
return;
}
commandStack.execute(cmd);
}
use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor 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.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.
the class NodePart method setSelected.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#setSelected(int)
*/
@Override
@SuppressWarnings("unchecked")
public void setSelected(final int value) {
if (value == SELECTED) {
super.setSelected(SELECTED_PRIMARY);
} else {
super.setSelected(value);
}
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (value == SELECTED_NONE) {
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
ComponentSettingsView compSettings = viewer;
compSettings.cleanDisplay();
return;
}
IEditorPart activeEditor = page.getActiveEditor();
if (activeEditor instanceof AbstractMultiPageTalendEditor) {
GraphicalViewer designerViewer = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor().getViewer();
Control ctrl = designerViewer.getControl();
String helpLink = (String) ((Node) getModel()).getPropertyValue(EParameterName.HELP.getName());
String requiredHelpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
if (helpLink == null || "".equals(helpLink) || !requiredHelpLink.equals(helpLink)) {
//$NON-NLS-1$
helpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
}
if (ctrl != null) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl, helpLink);
}
// This code was to update automatically the help view, to set the documentation of the selected component
// remove for TDI-24396
// IViewPart view = page.findView("org.eclipse.help.ui.HelpView"); //$NON-NLS-1$
// if (view != null) {
// PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpLink);
// }
TalendSelectionManager selectionManager = (TalendSelectionManager) designerViewer.getSelectionManager();
if (value == SELECTED || value == SELECTED_PRIMARY) {
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
if (selectionManager.getSelectionType() == ETalendSelectionType.SINGLE) {
ComponentSettingsView compSettings = viewer;
compSettings.setElement((Node) getModel());
if (((Node) getModel()).getComponent() instanceof DummyComponent) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
Messages.getString("NodePart_warning"), //$NON-NLS-1$
Messages.getString("NodePart_componentNotLoaded"));
return;
}
CodeView.refreshCodeView((Node) getModel());
} else if (!viewer.isCleaned() && selectionManager.getSelectionType() == ETalendSelectionType.MULTIPLE) {
ComponentSettingsView compSettings = viewer;
compSettings.cleanDisplay();
} else if (isDrop()) {
if (value == SELECTED || value == SELECTED_PRIMARY) {
ComponentSettingsView compSettings = viewer;
compSettings.setElement((Node) getModel());
if (((Node) getModel()).getComponent() instanceof DummyComponent) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
Messages.getString("NodePart_warning"), //$NON-NLS-1$
Messages.getString("NodePart_componentNotLoaded"));
return;
}
CodeView.refreshCodeView((Node) getModel());
}
}
}
}
}
Aggregations