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();
}
Aggregations