Search in sources :

Example 1 with FloatingPalette

use of com.archimatetool.editor.diagram.FloatingPalette in project archi by archimatetool.

the class FullScreenAction method run.

@Override
public void run() {
    fGraphicalViewer = getWorkbenchPart().getAdapter(GraphicalViewer.class);
    fOldParent = fGraphicalViewer.getControl().getParent();
    fOldPaletteViewer = fGraphicalViewer.getEditDomain().getPaletteViewer();
    // Set Property so clients know this is in full screen mode
    // $NON-NLS-1$
    fGraphicalViewer.setProperty("full_screen", true);
    addKeyBindings();
    // Add key and menu listeners
    fGraphicalViewer.getContextMenu().addMenuListener(contextMenuListener);
    fGraphicalViewer.getControl().addKeyListener(keyListener);
    // Create new Shell
    fNewShell = new Shell(Display.getCurrent(), SWT.NONE);
    // To put the full screen on the current monitor
    fNewShell.setLocation(fOldParent.getShell().getLocation());
    fNewShell.setFullScreen(true);
    fNewShell.setMaximized(true);
    fNewShell.setText(Display.getAppName());
    fNewShell.setLayout(new FillLayout());
    fNewShell.setImage(IArchiImages.ImageFactory.getImage(IArchiImages.ICON_APP_128));
    // On Ubuntu the min/max/close buttons are shown, so trap the close button
    fNewShell.addShellListener(new ShellAdapter() {

        @Override
        public void shellClosed(ShellEvent e) {
            close();
        }
    });
    // Set the Viewer's control's parent to be the new Shell
    fGraphicalViewer.getControl().setParent(fNewShell);
    fNewShell.layout();
    fNewShell.open();
    fFloatingPalette = new FloatingPalette((IDiagramModelEditor) ((DefaultEditDomain) fGraphicalViewer.getEditDomain()).getEditorPart(), fNewShell);
    if (fFloatingPalette.getPaletteState().isOpen) {
        fFloatingPalette.open();
    }
    // Disable the old parent shell
    fOldParent.getShell().setEnabled(false);
    // Listen to Parts being closed
    getWorkbenchPart().getSite().getWorkbenchWindow().getPartService().addPartListener(partListener);
    // Set Focus on new Shell
    fNewShell.setFocus();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ShellAdapter(org.eclipse.swt.events.ShellAdapter) GraphicalViewer(org.eclipse.gef.GraphicalViewer) ShellEvent(org.eclipse.swt.events.ShellEvent) FillLayout(org.eclipse.swt.layout.FillLayout) IDiagramModelEditor(com.archimatetool.editor.diagram.IDiagramModelEditor) FloatingPalette(com.archimatetool.editor.diagram.FloatingPalette)

Aggregations

FloatingPalette (com.archimatetool.editor.diagram.FloatingPalette)1 IDiagramModelEditor (com.archimatetool.editor.diagram.IDiagramModelEditor)1 GraphicalViewer (org.eclipse.gef.GraphicalViewer)1 ShellAdapter (org.eclipse.swt.events.ShellAdapter)1 ShellEvent (org.eclipse.swt.events.ShellEvent)1 FillLayout (org.eclipse.swt.layout.FillLayout)1 Shell (org.eclipse.swt.widgets.Shell)1