Search in sources :

Example 1 with AgentConfigEditor

use of org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor in project netxms by netxms.

the class AgentConfigEditorView 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());
    editor = new AgentConfigEditor(parent, SWT.NONE, SWT.H_SCROLL | SWT.V_SCROLL);
    editor.getTextWidget().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            if (!dirty) {
                modified = true;
                dirty = true;
                firePropertyChange(PROP_DIRTY);
                actionSave.setEnabled(true);
            }
        }
    });
    createActions();
    contributeToActionBars();
    actionSave.setEnabled(false);
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) AgentConfigEditor(org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor) ModifyListener(org.eclipse.swt.events.ModifyListener) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 2 with AgentConfigEditor

use of org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor in project netxms by netxms.

the class ConfigPolicyEditor method createPartControl.

/* (non-Javadoc)
    * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
    */
@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    parent.setLayout(new FillLayout());
    editor = new AgentConfigEditor(parent, SWT.NONE, SWT.H_SCROLL | SWT.V_SCROLL);
    editor.getTextWidget().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            setModified();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) AgentConfigEditor(org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor) ModifyListener(org.eclipse.swt.events.ModifyListener) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 3 with AgentConfigEditor

use of org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor in project netxms by netxms.

the class ServerStoredAgentConfigEditorView 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());
    SashForm splitter = new SashForm(parent, SWT.HORIZONTAL);
    splitter.setSashWidth(3);
    Composite listContainer = new Composite(splitter, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    layout.horizontalSpacing = 0;
    listContainer.setLayout(layout);
    configList = new TableViewer(listContainer, SWT.FULL_SELECTION | SWT.SINGLE);
    configList.setContentProvider(new ArrayContentProvider());
    configList.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            onSelectionChange(event);
        }
    });
    configList.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    new Label(listContainer, SWT.SEPARATOR | SWT.VERTICAL).setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true));
    /**
     ** editor section ***
     */
    FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay());
    Composite formContainer = new Composite(splitter, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    layout.horizontalSpacing = 0;
    formContainer.setLayout(layout);
    new Label(formContainer, SWT.SEPARATOR | SWT.VERTICAL).setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true));
    form = toolkit.createScrolledForm(formContainer);
    form.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    form.setText(Messages.get().ServerStoredAgentConfigEditorView_Noname);
    layout = new GridLayout();
    form.getBody().setLayout(layout);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    form.getBody().setLayoutData(gridData);
    splitter.setWeights(new int[] { 20, 80 });
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText(Messages.get().ServerStoredAgentConfigEditorView_Name);
    layout = new GridLayout();
    section.setLayout(layout);
    gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    section.setLayoutData(gridData);
    /**
     ** Name ***
     */
    nameField = new Text(section, SWT.BORDER);
    section.setClient(nameField);
    gridData = new GridData();
    gridData.horizontalAlignment = SWT.FILL;
    gridData.grabExcessHorizontalSpace = true;
    nameField.setLayoutData(gridData);
    nameField.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onTextModify();
        }
    });
    /**
     ** Filter ***
     */
    section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText(Messages.get().ServerStoredAgentConfigEditorView_Filter);
    section.setLayout(layout);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    section.setLayoutData(gridData);
    filterEditor = new ScriptEditor(section, SWT.BORDER, SWT.H_SCROLL | SWT.V_SCROLL, true, "Variables:\r\n\t$1\tIP address\r\n\t$2\tplatform name\r\n\t$3\tmajor agent version number\r\n\t$4\tminor agent version number\r\n\t$5\trelease number\r\n\r\nReturn value: true if this configuration should be sent to agent");
    section.setClient(filterEditor);
    filterEditor.getTextWidget().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onTextModify();
        }
    });
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    filterEditor.setLayoutData(gridData);
    /**
     ** Config ***
     */
    section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
    section.setText(Messages.get().ServerStoredAgentConfigEditorView_ConfigFile);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    section.setLayoutData(gridData);
    configEditor = new AgentConfigEditor(section, SWT.BORDER, SWT.H_SCROLL | SWT.V_SCROLL, 0);
    section.setClient(configEditor);
    configEditor.getTextWidget().addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            onTextModify();
        }
    });
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    configEditor.setLayoutData(gridData);
    createActions();
    contributeToActionBars();
    createPopupMenu();
    actionSave.setEnabled(false);
    getConfigList();
}
Also used : AgentConfigEditor(org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor) Composite(org.eclipse.swt.widgets.Composite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ModifyListener(org.eclipse.swt.events.ModifyListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Text(org.eclipse.swt.widgets.Text) FillLayout(org.eclipse.swt.layout.FillLayout) Section(org.eclipse.ui.forms.widgets.Section) ScriptEditor(org.netxms.ui.eclipse.nxsl.widgets.ScriptEditor) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) GridData(org.eclipse.swt.layout.GridData) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)3 ModifyListener (org.eclipse.swt.events.ModifyListener)3 FillLayout (org.eclipse.swt.layout.FillLayout)3 AgentConfigEditor (org.netxms.ui.eclipse.agentmanager.widgets.AgentConfigEditor)3 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 SashForm (org.eclipse.swt.custom.SashForm)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1 Section (org.eclipse.ui.forms.widgets.Section)1 ScriptEditor (org.netxms.ui.eclipse.nxsl.widgets.ScriptEditor)1