Search in sources :

Example 1 with IManagedForm

use of org.eclipse.ui.forms.IManagedForm in project liferay-ide by liferay.

the class IDEFormPage method createPartControl.

/**
 * (non-Javadoc)
 * @see
 * FormPage#createPartControl(org.eclipse.swt.
 * widgets.Composite)
 */
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    // Dynamically add focus listeners to all the forms children in order
    // to track the last focus control
    IManagedForm managedForm = getManagedForm();
    if (managedForm != null) {
        addLastFocusListeners(managedForm.getForm());
    }
}
Also used : IManagedForm(org.eclipse.ui.forms.IManagedForm)

Example 2 with IManagedForm

use of org.eclipse.ui.forms.IManagedForm in project liferay-ide by liferay.

the class IDEFormPage method createUISectionContainer.

public Composite createUISectionContainer(Composite parent, int columns) {
    IManagedForm managedForm = getManagedForm();
    Composite container = managedForm.getToolkit().createComposite(parent);
    container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, columns));
    return container;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) IManagedForm(org.eclipse.ui.forms.IManagedForm)

Example 3 with IManagedForm

use of org.eclipse.ui.forms.IManagedForm in project liferay-ide by liferay.

the class IDEFormPage method createUISection.

public Section createUISection(Composite parent, String text, String description, int style) {
    IManagedForm managedForm = getManagedForm();
    Section section = managedForm.getToolkit().createSection(parent, style);
    section.clientVerticalSpacing = FormLayoutFactory.SECTION_HEADER_VERTICAL_SPACING;
    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    section.setText(text);
    section.setDescription(description);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    section.setLayoutData(data);
    return section;
}
Also used : IManagedForm(org.eclipse.ui.forms.IManagedForm) GridData(org.eclipse.swt.layout.GridData) Section(org.eclipse.ui.forms.widgets.Section)

Example 4 with IManagedForm

use of org.eclipse.ui.forms.IManagedForm in project tdq-studio-se by Talend.

the class AbstractMetadataFormPage method getFocusControl.

protected Control getFocusControl() {
    IManagedForm managedForm = getManagedForm();
    if (managedForm == null) {
        return null;
    }
    Control control = managedForm.getForm();
    if (control == null || control.isDisposed()) {
        return null;
    }
    Display display = control.getDisplay();
    Control focusControl = display.getFocusControl();
    if (focusControl == null || focusControl.isDisposed()) {
        return null;
    }
    return focusControl;
}
Also used : Control(org.eclipse.swt.widgets.Control) IManagedForm(org.eclipse.ui.forms.IManagedForm) Display(org.eclipse.swt.widgets.Display)

Example 5 with IManagedForm

use of org.eclipse.ui.forms.IManagedForm in project webtools.servertools by eclipse.

the class ServerPropertiesEditorSection method init.

public void init(final IEditorSite site, IEditorInput input) {
    super.init(site, input);
    if (server != null) {
        fServer = (GenericServer) server.loadAdapter(GenericServer.class, new NullProgressMonitor());
    }
    fPropertyChangeListener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(GenericServerRuntime.SERVER_INSTANCE_PROPERTIES)) {
                if (!fUpdating) {
                    fUpdating = true;
                    updateControls();
                    fUpdating = false;
                }
            }
        }
    };
    server.addPropertyChangeListener(fPropertyChangeListener);
    fLaunchListener = new ILaunchesListener2() {

        public void launchesRemoved(ILaunch[] launches) {
        // Nothing to do
        }

        private ILaunchConfiguration getServerLaunchConfig(ILaunch[] launches) {
            for (int i = 0; i < launches.length; i++) {
                ILaunchConfiguration launchConfig = launches[i].getLaunchConfiguration();
                if (launchConfig != null) {
                    String serverId;
                    try {
                        serverId = launchConfig.getAttribute(GenericServerBehaviour.ATTR_SERVER_ID, (String) null);
                        if (fServer.getServer().getId().equals(serverId)) {
                            return launchConfig;
                        }
                    } catch (CoreException e) {
                    // Ignore
                    }
                }
            }
            return null;
        }

        public void launchesChanged(ILaunch[] launches) {
        // Nothing to do
        }

        public void launchesAdded(ILaunch[] launches) {
            ILaunchConfiguration lc = getServerLaunchConfig(launches);
            try {
                if (lc != null) {
                    if ("true".equals(lc.getAttribute(GenericServerBehaviour.ATTR_STOP, "false"))) {
                        // $NON-NLS-1$ //$NON-NLS-2$
                        site.getWorkbenchWindow().getWorkbench().getDisplay().asyncExec(new Runnable() {

                            public void run() {
                                IManagedForm managedForm = getManagedForm();
                                managedForm.getMessageManager().removeMessage(MESSAGE_ID_SERVER_RUNNING);
                                managedForm.getMessageManager().update();
                            }
                        });
                    } else {
                        site.getWorkbenchWindow().getWorkbench().getDisplay().asyncExec(new Runnable() {

                            public void run() {
                                getManagedForm().getMessageManager().addMessage(MESSAGE_ID_SERVER_RUNNING, GenericServerUIMessages.serverRunningCanNotSave, null, IMessageProvider.WARNING);
                            }
                        });
                    }
                }
            } catch (CoreException e) {
                GenericUiPlugin.getDefault().getLog().log(e.getStatus());
            }
        }

        public void launchesTerminated(ILaunch[] launches) {
            if (getServerLaunchConfig(launches) != null) {
                site.getWorkbenchWindow().getWorkbench().getDisplay().asyncExec(new Runnable() {

                    public void run() {
                        getManagedForm().getMessageManager().removeMessage(MESSAGE_ID_SERVER_RUNNING);
                    }
                });
            }
        }
    };
    getLaunchManager().addLaunchListener(fLaunchListener);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) PropertyChangeEvent(java.beans.PropertyChangeEvent) ILaunchConfiguration(org.eclipse.debug.core.ILaunchConfiguration) PropertyChangeListener(java.beans.PropertyChangeListener) CoreException(org.eclipse.core.runtime.CoreException) IManagedForm(org.eclipse.ui.forms.IManagedForm) ILaunch(org.eclipse.debug.core.ILaunch) ILaunchesListener2(org.eclipse.debug.core.ILaunchesListener2)

Aggregations

IManagedForm (org.eclipse.ui.forms.IManagedForm)15 Composite (org.eclipse.swt.widgets.Composite)6 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)5 GridData (org.eclipse.swt.layout.GridData)4 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)4 GridLayout (org.eclipse.swt.layout.GridLayout)3 ScrolledForm (org.eclipse.ui.forms.widgets.ScrolledForm)3 MDSashForm (bndtools.editor.common.MDSashForm)2 MessageHyperlinkAdapter (bndtools.utils.MessageHyperlinkAdapter)2 IFile (org.eclipse.core.resources.IFile)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 SelectionListener (org.eclipse.swt.events.SelectionListener)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Button (org.eclipse.swt.widgets.Button)2 Control (org.eclipse.swt.widgets.Control)2 PartInitException (org.eclipse.ui.PartInitException)2 IFormPage (org.eclipse.ui.forms.editor.IFormPage)2 Form (org.eclipse.ui.forms.widgets.Form)2 Section (org.eclipse.ui.forms.widgets.Section)2