Search in sources :

Example 1 with Shell

use of org.eclipse.swt.widgets.Shell in project cogtool by cogtool.

the class UI method performAction.

/**
     * Wrapper method for invoking performAction; uses this as the
     * transmuter.  ContextMenuManager is currently the only place that
     * invokes performAction as "context".
     *
     * @param id the general semantic LID to lookup and perform action for
     * @param isContextSelection true if we should specialize based on the
     *                           current contextual selection;
     *                           false to use the standard selection
     * @return <code>true</code> if it is ok to continue with action processing
     *         and <code>false</code> if processing should stop.
     */
public boolean performAction(ListenerIdentifier id, boolean isContextSelection) {
    View view = getView();
    boolean wasPerforming = view.isPerformingAction();
    Shell s = getShell();
    Cursor oldCursor = s.getCursor();
    view.setStatusMessage("");
    view.setPerformingAction(true);
    s.setCursor(WindowUtil.BUSY_CURSOR_INSTANCE);
    // false means a normal action, not caused by a context menu selection
    try {
        return lIDMap.performAction(this, id, isContextSelection);
    } catch (RecoverableException ex) {
        RcvrExceptionHandler.recover(ex, getStandardInteraction());
    } finally {
        view.setPerformingAction(wasPerforming);
        if (!s.isDisposed()) {
            s.setCursor(oldCursor);
        }
    }
    return false;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) Cursor(org.eclipse.swt.graphics.Cursor) AboutView(edu.cmu.cs.hcii.cogtool.view.AboutView) View(edu.cmu.cs.hcii.cogtool.view.View) RecoverableException(edu.cmu.cs.hcii.cogtool.util.RecoverableException)

Example 2 with Shell

use of org.eclipse.swt.widgets.Shell in project cogtool by cogtool.

the class View method setVisible.

/**
     * Set whether the associated window (and view) is visible.
     *
     * @param visible true iff the associated window/view should be visible
     * @author mlh
     */
public void setVisible(boolean visible) {
    Shell window = getShell();
    if (window != null) {
        if (visible) {
            // Suppress drawing until everything is done.
            //                setDrawingOK(false);
            WindowUtil.display(window, false);
            // Recompute layout of the shell contents.
            // Should not be called too often, but since SetVisible should
            // only be called on window creation it should be done here.
            window.layout(true, true);
        //                setDrawingOK(true);
        } else {
            window.setVisible(false);
        }
    } else {
        throw new RcvrUIException("No window available for setting window visibility.");
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) RcvrUIException(edu.cmu.cs.hcii.cogtool.util.RcvrUIException)

Example 3 with Shell

use of org.eclipse.swt.widgets.Shell in project cogtool by cogtool.

the class View method takeFocus.

/**
     * Bring the associated window to the front and make active by
     * making the window have the focus and "un-minimize" it.
     *
     * @author mlh
     */
public void takeFocus() {
    Shell window = getShell();
    if (window != null) {
        window.setActive();
        window.setMinimized(false);
    } else {
        throw new RcvrUIException("No window available for taking the focus.");
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) RcvrUIException(edu.cmu.cs.hcii.cogtool.util.RcvrUIException)

Example 4 with Shell

use of org.eclipse.swt.widgets.Shell in project cogtool by cogtool.

the class DefaultUI method setInitiallyEnabled.

/**
     * Sets the "always-enabled" widgets;
     * call this at the end of the subclass constructor!
     * <p>
     * All model editing windows support:
     *   Paste, SaveProject, SaveProjectAs, and CloseWindow
     * <p>
     * Take this opportunity to interpose a listener when the
     * associated SWT window is closed by the user without using
     * a CogTool menu item.  This listener will also save the window's
     * location in case a new window is restored for the associated
     * model object.
     *
     * @author mlh
     */
@Override
protected void setInitiallyEnabled(boolean forConstruction) {
    super.setInitiallyEnabled(forConstruction);
    if (undoMgrViewHandler != null) {
        undoMgrViewHandler.resetView(undoManager);
    }
    setEnabled(CogToolLID.Paste, ListenerIdentifierMap.ALL, MenuUtil.ENABLED);
    setEnabled(CogToolLID.SaveProject, ListenerIdentifierMap.ALL, MenuUtil.ENABLED);
    setEnabled(CogToolLID.SaveProjectAs, ListenerIdentifierMap.ALL, MenuUtil.ENABLED);
    setEnabled(CogToolLID.CloseWindow, ListenerIdentifierMap.ALL, MenuUtil.ENABLED);
    setEnabled(CogToolLID.CloseProject, ListenerIdentifierMap.ALL, MenuUtil.ENABLED);
    setEnabled(CogToolLID.Properties, ListenerIdentifierMap.ALL, MenuUtil.ENABLED);
    Shell window = getShell();
    if (forConstruction && (window != null)) {
        window.removeShellListener(closeListener);
        window.addShellListener(closeListener);
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell)

Example 5 with Shell

use of org.eclipse.swt.widgets.Shell in project cogtool by cogtool.

the class DefaultUI method dispose.

/**
     * Recover any system resources being used to support the view being
     * used by this UI instance.
     * <p>
     * At this point, we must remove alert handlers and the interposed
     * listener on the associated SWT Shell object.
     *
     * @author mlh
     */
@Override
public void dispose() {
    if (undoManager != null) {
        undoManager.removeAllHandlers(this);
    }
    project.removeAllHandlers(this);
    try {
        UndoManager.removeSavePointChangeHandler(project, undoMgrTitleHandler);
    } catch (IllegalStateException ex) {
        System.err.println("Ignoring fact that removeSavePointChangeHandler failed.");
    }
    Shell window = getShell();
    CogTool.controllerNexus.saveWindowLocation(project, getModelObject(), window.getBounds());
    if (window != null) {
        if (closeListener != null) {
            window.removeShellListener(closeListener);
        }
    }
    super.dispose();
}
Also used : Shell(org.eclipse.swt.widgets.Shell)

Aggregations

Shell (org.eclipse.swt.widgets.Shell)324 Display (org.eclipse.swt.widgets.Display)49 Button (org.eclipse.swt.widgets.Button)30 SelectionEvent (org.eclipse.swt.events.SelectionEvent)28 Point (org.eclipse.swt.graphics.Point)28 Composite (org.eclipse.swt.widgets.Composite)28 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)27 GridData (org.eclipse.swt.layout.GridData)27 GridLayout (org.eclipse.swt.layout.GridLayout)26 ArrayList (java.util.ArrayList)25 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)23 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)22 IFile (org.eclipse.core.resources.IFile)22 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)21 File (java.io.File)19 InvocationTargetException (java.lang.reflect.InvocationTargetException)19 Text (org.eclipse.swt.widgets.Text)19 FillLayout (org.eclipse.swt.layout.FillLayout)17 Label (org.eclipse.swt.widgets.Label)17 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)16