use of org.netxms.ui.eclipse.widgets.TextConsole in project netxms by netxms.
the class ScriptExecutor method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new FillLayout());
/**
** Script executor form ***
*/
FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay());
Composite formContainer = new Composite(parent, SWT.NONE);
formContainer.setLayout(new FillLayout());
form = toolkit.createForm(formContainer);
form.setText(Messages.get().ScriptExecutor_Noname);
GridLayout layout = new GridLayout();
layout.verticalSpacing = 8;
form.getBody().setLayout(layout);
/**
** Script list dropdown ***
*/
scriptCombo = WidgetHelper.createLabeledCombo(form.getBody(), SWT.READ_ONLY, Messages.get().ScriptExecutor_LibScript, WidgetHelper.DEFAULT_LAYOUT_DATA, toolkit);
updateScriptList(null);
scriptCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (modified) {
if (saveIfRequired(true))
return;
}
getScriptContent();
previousSelection = scriptCombo.getSelectionIndex();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
SashForm splitter = new SashForm(form.getBody(), SWT.VERTICAL);
splitter.setSashWidth(3);
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
splitter.setLayoutData(gridData);
/**
** Script editor ***
*/
Composite container = toolkit.createComposite(splitter);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginBottom = 4;
container.setLayout(layout);
Section section = toolkit.createSection(container, Section.TITLE_BAR);
section.setText(Messages.get().ScriptExecutor_Source);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
section.setLayoutData(gridData);
scriptEditor = new ScriptEditor(section, SWT.BORDER, SWT.H_SCROLL | SWT.V_SCROLL, true);
section.setClient(scriptEditor);
// $NON-NLS-1$
scriptEditor.setText("");
scriptEditor.getTextWidget().addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
onTextModify();
}
});
/**
** Execution result ***
*/
container = toolkit.createComposite(splitter);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.marginTop = 4;
container.setLayout(layout);
section = toolkit.createSection(container, Section.TITLE_BAR);
section.setText(Messages.get().ScriptExecutor_Output);
gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
section.setLayoutData(gridData);
output = new TextConsole(section, SWT.BORDER);
section.setClient(output);
/*executionResult.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e)
{
actionCopy.setEnabled(executionResult.getSelectionCount() > 0);
}
});*/
// TODO: Think how to split copy action between 2 editors
activateContext();
createActions();
contributeToActionBars();
actionSave.setEnabled(false);
}
use of org.netxms.ui.eclipse.widgets.TextConsole in project netxms by netxms.
the class AbstractCommandResults method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
console = new TextConsole(parent, SWT.NONE);
console.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
actionCopy.setEnabled(console.canCopy());
}
});
createActions();
contributeToActionBars();
createPopupMenu();
activateContext();
}
Aggregations