use of org.eclipse.swt.events.ShellEvent in project tdi-studio-se by Talend.
the class MapperUI method createWindow.
public Shell createWindow(final Display display) {
Shell activeShell = display.getActiveShell();
int style = SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL | SWT.RESIZE;
if (activeShell == null) {
mapperShell = new Shell(mapperShell, style);
} else {
mapperShell = new Shell(activeShell, style);
}
mapperShell.addShellListener(new ShellListener() {
@Override
public void shellActivated(ShellEvent e) {
}
@Override
public void shellClosed(ShellEvent e) {
if (editor != null && editor.isDirty() && !closeWithoutPrompt) {
boolean closeWindow = MessageDialog.openConfirm(mapperShell, "Close without save", Messages.getString("MapperUI.CloseWindow.Message"));
if (!closeWindow) {
e.doit = false;
} else {
prepareClosing(SWT.CANCEL);
}
}
}
@Override
public void shellDeactivated(ShellEvent e) {
}
@Override
public void shellDeiconified(ShellEvent e) {
}
@Override
public void shellIconified(ShellEvent e) {
}
});
mapperShell.setMaximized(true);
mapperShell.setImage(CoreImageProvider.getComponentIcon(mapperComponent.getComponent(), ICON_SIZE.ICON_32));
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String productName = brandingService.getFullProductName();
mapperShell.setText(productName + " - " + mapperComponent.getComponent().getName() + " - " + //$NON-NLS-1$
mapperComponent.getUniqueName());
GridLayout parentLayout = new GridLayout(1, true);
mapperShell.setLayout(parentLayout);
// Composite composite = new Composite(mapperShell, SWT.NONE);
// composite.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
mainSashForm = new SashForm(mapperShell, SWT.SMOOTH | SWT.VERTICAL);
GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
mainSashForm.setLayoutData(mainSashFormGridData);
datasViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
editor = new XmlMapEditor(mapperManager);
editor.createPartControl(datasViewSashForm);
if (copyOfMapData.getVarTables().isEmpty()) {
VarTable varTable1 = XmlmapFactory.eINSTANCE.createVarTable();
varTable1.setName("Var");
varTable1.setMinimized(true);
copyOfMapData.getVarTables().add(varTable1);
}
editor.setContent(copyOfMapData);
tabFolderEditors = new TabFolderEditors(mainSashForm, mapperManager, SWT.BORDER);
// selectFirstInOutTree();
mainSashForm.setWeights(new int[] { 70, 30 });
footerComposite = new FooterComposite(mapperShell, this);
footerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mapperShell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
ColorProviderMapper.releaseColors();
FontProviderMapper.releaseFonts();
ImageProviderMapper.releaseImages();
}
});
editor.makeDefaultSelection();
mapperShell.open();
return mapperShell;
}
use of org.eclipse.swt.events.ShellEvent in project cubrid-manager by CUBRID.
the class TuneModeResultWindow method open.
public void open() {
shell = new Shell(SWT.RESIZE | SWT.DIALOG_TRIM | SWT.MAX | SWT.MIN);
shell.setLayout(new GridLayout());
shell.setLayoutData(new GridData(GridData.FILL_BOTH));
shell.setText(Messages.lblTuneModeResult);
shell.setImage(CommonUIPlugin.getImage("icons/queryeditor/tune_mode.png"));
shell.setSize(800, 600);
shell.setMaximized(true);
tuneModeResult = new TuneModeResultComposite(shell, SWT.NONE);
tuneModeResult.setLayout(new GridLayout());
tuneModeResult.setLayoutData(new GridData(GridData.FILL_BOTH));
tuneModeResult.initialize();
DatabaseInfo databaseInfo = (editor == null || editor.getSelectedDatabase() == null) ? null : editor.getSelectedDatabase().getDatabaseInfo();
tuneModeResult.setDatabaseInfo(databaseInfo);
shell.addShellListener(new ShellListener() {
public void shellIconified(ShellEvent e) {
editor.hideTuneModeResult();
}
public void shellDeiconified(ShellEvent e) {
}
public void shellDeactivated(ShellEvent e) {
}
public void shellClosed(ShellEvent e) {
disposed = true;
if (tuneModeResult != null && !tuneModeResult.isDisposed()) {
tuneModeResult.dispose();
tuneModeResult = null;
}
if (shell != null && !shell.isDisposed()) {
shell.dispose();
shell.close();
}
}
public void shellActivated(ShellEvent e) {
}
});
shell.open();
}
use of org.eclipse.swt.events.ShellEvent in project bndtools by bndtools.
the class JpmDependencyWizardPage method createControl.
@Override
@SuppressWarnings("unused")
public void createControl(Composite parent) {
// CREATE CONTROLS
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
Label lblDirect = new Label(container, SWT.NONE);
lblDirect.setFont(JFaceResources.getBannerFont());
lblDirect.setText("Direct Dependencies:");
Table tblDirect = new Table(container, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL);
viewerDirect = new TableViewer(tblDirect);
viewerDirect.setContentProvider(ArrayContentProvider.getInstance());
viewerDirect.setLabelProvider(new ResourceDescriptorLabelProvider());
createHelpLabel(container, "The above dependencies will be added to the project and, if necessary, to the JPM4J local index.");
Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
Label lblIndirect = new Label(container, SWT.NONE);
lblIndirect.setFont(JFaceResources.getBannerFont());
lblIndirect.setText("Transitive Dependencies:");
Composite cmpIndirect = new Composite(container, SWT.NONE);
Table tblIndirect = new Table(cmpIndirect, SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL);
viewerIndirect = new CheckboxTableViewer(tblIndirect);
viewerIndirect.setContentProvider(ArrayContentProvider.getInstance());
viewerIndirect.setLabelProvider(new ResourceDescriptorLabelProvider());
Button btnSelectAll = new Button(cmpIndirect, SWT.PUSH);
btnSelectAll.setText("All");
Button btnSelectNone = new Button(cmpIndirect, SWT.PUSH);
btnSelectNone.setText("None");
new Label(cmpIndirect, SWT.NONE);
createHelpLabel(container, "The above dependencies will be added to the JPM4J local index. Checked dependencies will also be added directly to the project.");
// LISTENERS
// Query JPM and show results *after* dialog is shown. This ensures progress is visible in the dialog's
// progress bar
getContainer().getShell().addShellListener(new ShellAdapter() {
@Override
public void shellActivated(ShellEvent e) {
runQuery();
}
});
viewerIndirect.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent ev) {
if (selectedIndirectResources == null)
selectedIndirectResources = new HashSet<ResourceDescriptor>();
ResourceDescriptor resource = (ResourceDescriptor) ev.getElement();
if (ev.getChecked())
selectedIndirectResources.add(resource);
else
selectedIndirectResources.remove(resource);
}
});
btnSelectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedIndirectResources.addAll(indirectResources);
updateSelectedCheckboxes();
}
});
btnSelectNone.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedIndirectResources.clear();
updateSelectedCheckboxes();
}
});
viewerDirect.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection sel = event.getSelection();
if (sel.isEmpty())
selection = (ResourceDescriptor) ((IStructuredSelection) viewerIndirect.getSelection()).getFirstElement();
else
selection = (ResourceDescriptor) ((IStructuredSelection) sel).getFirstElement();
getContainer().updateMessage();
}
});
viewerIndirect.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection sel = event.getSelection();
if (sel.isEmpty())
selection = (ResourceDescriptor) ((IStructuredSelection) viewerDirect.getSelection()).getFirstElement();
else
selection = (ResourceDescriptor) ((IStructuredSelection) sel).getFirstElement();
getContainer().updateMessage();
}
});
// LAYOUT
GridLayout layout;
GridData gd;
layout = new GridLayout(1, true);
container.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
gd.heightHint = 30;
tblDirect.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
separator.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
cmpIndirect.setLayoutData(gd);
layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.horizontalSpacing = 2;
layout.verticalSpacing = 2;
cmpIndirect.setLayout(layout);
gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3);
gd.heightHint = 100;
tblIndirect.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, false, false);
btnSelectAll.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, false, false);
btnSelectNone.setLayoutData(gd);
}
use of org.eclipse.swt.events.ShellEvent in project translationstudio8 by heartsome.
the class TermDbManagerDialog method configureShell.
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.getString("dialog.TermDbManagerDialog.title"));
newShell.addShellListener(new ShellAdapter() {
public void shellActivated(ShellEvent e) {
if (lastShellSize == null) {
lastShellSize = getShell().getSize();
}
}
});
}
use of org.eclipse.swt.events.ShellEvent in project translationstudio8 by heartsome.
the class ColumnStyleEditorDialog method initComponents.
@Override
protected void initComponents(final Shell shell) {
shell.setLayout(new GridLayout());
shell.setText("Customize style");
// Closing the window is the same as canceling the form
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
doFormCancel(shell);
}
});
// Tabs panel
Composite tabPanel = new Composite(shell, SWT.NONE);
tabPanel.setLayout(new GridLayout());
GridData fillGridData = new GridData();
fillGridData.grabExcessHorizontalSpace = true;
fillGridData.horizontalAlignment = GridData.FILL;
tabPanel.setLayoutData(fillGridData);
CTabFolder tabFolder = new CTabFolder(tabPanel, SWT.BORDER);
tabFolder.setLayout(new GridLayout());
tabFolder.setLayoutData(fillGridData);
CTabItem columnTab = new CTabItem(tabFolder, SWT.NONE);
columnTab.setText("Column");
columnTab.setImage(GUIHelper.getImage("column"));
columnTab.setControl(createColumnPanel(tabFolder));
try {
cellStyleEditorPanel.edit(columnStyle);
borderStyleEditorPanel.edit(columnStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE));
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
Aggregations