List of usage examples for org.eclipse.jface.dialogs MessageDialog openWarning
public static void openWarning(Shell parent, String title, String message)
From source file:ac.at.tuwien.dsg.uml.classdiagram.export.transformation.classdiagramtoruntimeteststransformation.id.rules.ClassDiagramToJSONSystemDescriptionRule.java
License:Open Source License
private void notifyUser(String message) { Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning", message); }//from ww w .j a v a 2 s .c o m }); }
From source file:ac.at.tuwien.dsg.uml.classdiagram.export.transformation.engines.AbstractClassDiagramTestStrategy.java
License:Open Source License
/** * Method used to display message boxes with warnings or instructions to users * @param message// w w w. j a va2 s . c o m */ protected static void notifyUser(String message) { //add notification only of previous was closed if (!notificationThreads.containsKey(message) || !notificationThreads.get(message).isAlive()) { Thread t = new Thread() { @Override public void run() { Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning", message); } }); } }; notificationThreads.put(message, t); t.setDaemon(true); t.start(); } }
From source file:ac.at.tuwien.dsg.uml.statemachine.export.transformation.engines.AbstractStateMachineTestStrategy.java
License:Open Source License
/** * Method used to display message boxes with warnings or instructions to users * @param message/*from w ww . java 2 s .co m*/ */ protected void notifyUser(String message) { //add notification only of previous was closed if (!notificationThreads.containsKey(message) || !notificationThreads.get(message).isAlive()) { Thread t = new Thread() { @Override public void run() { Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Warning", message); } }); } }; notificationThreads.put(message, t); t.setDaemon(true); t.start(); } }
From source file:ac.soton.eventb.classdiagrams.diagram.part.ClassdiagramsDiagramEditor.java
License:Open Source License
/** * @generated// w w w. ja v a2 s . com */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind(Messages.ClassdiagramsDiagramEditor_SavingDeletedFile, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, Messages.ClassdiagramsDiagramEditor_SaveAsErrorTitle, Messages.ClassdiagramsDiagramEditor_SaveAsErrorMessage); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, Messages.ClassdiagramsDiagramEditor_SaveErrorTitle, Messages.ClassdiagramsDiagramEditor_SaveErrorMessage, x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }
From source file:ac.soton.eventb.statemachines.diagram.part.StatemachinesDiagramEditor.java
License:Open Source License
/** * @generated// w w w . j av a 2s .co m */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind(Messages.StatemachinesDiagramEditor_SavingDeletedFile, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, Messages.StatemachinesDiagramEditor_SaveAsErrorTitle, Messages.StatemachinesDiagramEditor_SaveAsErrorMessage); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, Messages.StatemachinesDiagramEditor_SaveErrorTitle, Messages.StatemachinesDiagramEditor_SaveErrorMessage, x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }
From source file:ac.soton.fmusim.components.diagram.part.ComponentsDiagramEditor.java
License:Open Source License
/** * @generated//w w w .j a va 2s .c o m */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind(Messages.ComponentsDiagramEditor_SavingDeletedFile, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, Messages.ComponentsDiagramEditor_SaveAsErrorTitle, Messages.ComponentsDiagramEditor_SaveAsErrorMessage); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, Messages.ComponentsDiagramEditor_SaveErrorTitle, Messages.ComponentsDiagramEditor_SaveErrorMessage, x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }
From source file:ac.soton.multisim.diagram.part.MultisimDiagramEditor.java
License:Open Source License
/** * @generated//from w w w .ja va 2s. c o m */ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); IEditorInput input = getEditorInput(); SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null; if (original != null) { dialog.setOriginalFile(original); } dialog.create(); IDocumentProvider provider = getDocumentProvider(); if (provider == null) { // editor has been programmatically closed while the dialog was open return; } if (provider.isDeleted(input) && original != null) { String message = NLS.bind(Messages.MultisimDiagramEditor_SavingDeletedFile, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) { progressMonitor.setCanceled(true); } return; } IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IFile file = workspaceRoot.getFile(filePath); final IEditorInput newInput = new FileEditorInput(file); // Check if the editor is already open IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy(); IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { if (matchingStrategy.matches(editorRefs[i], newInput)) { MessageDialog.openWarning(shell, Messages.MultisimDiagramEditor_SaveAsErrorTitle, Messages.MultisimDiagramEditor_SaveAsErrorMessage); return; } } boolean success = false; try { provider.aboutToChange(newInput); getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true); success = true; } catch (CoreException x) { IStatus status = x.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { ErrorDialog.openError(shell, Messages.MultisimDiagramEditor_SaveErrorTitle, Messages.MultisimDiagramEditor_SaveErrorMessage, x.getStatus()); } } finally { provider.changed(newInput); if (success) { setInput(newInput); } } if (progressMonitor != null) { progressMonitor.setCanceled(!success); } }
From source file:ag.ion.noa4e.ui.NOAUIPlugin.java
License:Open Source License
/** * Internal method in order to start the office application. * //from w ww . j ava2 s . com * @param shell shell to be used * @param officeApplication office application to be used * * @return status information * * @author Joerg Sigle * @date 24.06.2012 * @date 20.02.2012 00:57 * * @author Andreas Brker * @date 28.06.2006 * * Adopted for Elexis by Joerg Sigle 02/2012, adding the following line. * Changes required because of different preference store layout in Elexis. * There are corresponding changes in: * LocalOfficeApplicationsPreferencesPage.java * PREFS_PREVENT_TERMINATION * initPreferenceValues() * performOk() * NOAUIPlugin.java * PREFERENCE_OFFICE_HOME * PREFERENCE_PREVENT_TERMINATION * internalStartApplication(). */ private static IStatus internalStartApplication(final Shell shell, IOfficeApplication officeApplication) { System.out.println("NOAUIPlugin: internalStartApplication() begin"); if (officeApplication.isActive()) { System.out.println( "NOAUIPlugin: internalStartApplication(): officeApplication.isActive(), so returning immediately."); return Status.OK_STATUS; } System.out.println( "NOAUIPlugin: internalStartApplication(): !officeApplication.isActive(), so starting it up..."); boolean configurationChanged = false; boolean canStart = false; String home = null; HashMap configuration = new HashMap(1); //My warning in the following line referred to the original noa4e code: //System.out.println("NOAUIPlugin: internalStartApplication(): getting officeHome (WARNING: probably from the wrong source)..."); System.out.println("NOAUIPlugin: internalStartApplication(): getting officeHome..."); System.out.println( "NOAUIPlugin: internalStartApplication(): Using js mod adopted for Elexis, reproducing prior GW adoptions, P_OOBASEDIR via ...(Hub.localCfg)"); //JS modified this: //The original code tries to access a preference store which is not used in Elexis, //according to GWs mods in (back then:) LocalOfficeApplicationPreferencesPage.java //Unsuitable original line, removed: //String officeHome = getDefault().getPreferenceStore().getString(PREFERENCE_OFFICE_HOME); //Newly inserted lines: IPreferenceStore preferenceStore = new SettingsPreferenceStore(CoreHub.localCfg); String officeHome = preferenceStore.getString(PreferenceConstants.P_OOBASEDIR); if (officeHome == null) System.out.println("NOAUIPlugin: internalStartApplication(): WARNING: officeHome==null"); else System.out.println("NOAUIPlugin: internalStartApplication(): officeHome=" + officeHome); if (officeHome.length() != 0) { File file = new File(officeHome); if (file.canRead()) { System.out.println( "NOAUIPlugin: internalStartApplication(): Check: officeHome is a valid path. Setting canStart to true."); configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, officeHome); canStart = true; } else { System.out.println( "NOAUIPlugin: internalStartApplication(): WARNING: officeHome is NOT a valid path. Leaving canStart at false."); MessageDialog.openWarning(shell, Messages.NOAUIPlugin_dialog_warning_invalid_path_title, Messages.NOAUIPlugin_dialog_warning_invalid_path_message); } } System.out.println("NOAUIPlugin: internalStartApplication(): canStart=" + canStart); if (!canStart) { System.out.println( "NOAUIPlugin: internalStartApplication(): canStart==false; trying to auto locate available office suite installations..."); configurationChanged = true; ILazyApplicationInfo[] applicationInfos = null; boolean configurationCompleted = false; try { ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell); FindApplicationInfosOperation findApplicationInfosOperation = new FindApplicationInfosOperation(); progressMonitorDialog.run(true, true, findApplicationInfosOperation); applicationInfos = findApplicationInfosOperation.getApplicationsInfos(); if (applicationInfos.length == 1) { if (applicationInfos[0].getMajorVersion() == 2 || (applicationInfos[0].getMajorVersion() == 1 && applicationInfos[0].getMinorVersion() == 9)) { configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, applicationInfos[0].getHome()); configurationCompleted = true; } } } catch (Throwable throwable) { System.out.println( "NOAUIPlugin: internalStartApplication(): canStart==false; cannot auto locate an office suite installation. So we must search manually..."); //we must search manually } System.out.println( "NOAUIPlugin: internalStartApplication(): configurationCompleted=" + configurationCompleted); if (!configurationCompleted) { LocalApplicationWizard localApplicationWizard = new LocalApplicationWizard(applicationInfos); if (home != null && home.length() != 0) localApplicationWizard.setHomePath(home); WizardDialog wizardDialog = new WizardDialog(shell, localApplicationWizard); if (wizardDialog.open() == Window.CANCEL) return Status.CANCEL_STATUS; configuration.put(IOfficeApplication.APPLICATION_HOME_KEY, localApplicationWizard.getSelectedHomePath()); } } System.out.println( "NOAUIPlugin: internalStartApplication(): the office suite configuration should now be valid:"); if (officeApplication == null) System.out.println("NOAUIPlugin: internalStartApplication(): officeApplication==null"); else System.out.println( "NOAUIPlugin: internalStartApplication(): officeApplication=" + officeApplication.toString()); if (configuration == null) System.out.println("NOAUIPlugin: internalStartApplication(): configuration==null"); else System.out .println("NOAUIPlugin: internalStartApplication(): configuration=" + configuration.toString()); if (shell == null) System.out.println("NOAUIPlugin: internalStartApplication(): shell==null"); else System.out.println("NOAUIPlugin: internalStartApplication(): shell=" + shell.toString()); System.out.println( "NOAUIPlugin: internalStartApplication(): Finally trying activateOfficeApplication(officeApplication, configuration, shell):"); IStatus status = activateOfficeApplication(officeApplication, configuration, shell); if (configurationChanged) { System.out.println( "NOAUIPlugin: internalStartApplication(): Configuration of PREFERENCE_OFFICE_HOME changed."); System.out.println("NOAUIPlugin: internalStartApplication(): Storing the new configuration."); System.out.println( "NOAUIPlugin: internalStartApplication(): Using js mod adopted for Elexis, reproducing prior GW adoptions, P_OOBASEDIR via ...(Hub.localCfg)"); //JS modified this: //The original code tries to access a preference store which is not used in Elexis, //according to GWs mods in (back then:) LocalOfficeApplicationPreferencesPage.java //Unsuitable original line, removed: //getDefault().getPluginPreferences().setValue(PREFERENCE_OFFICE_HOME, // configuration.get(IOfficeApplication.APPLICATION_HOME_KEY).toString()); //Newly inserted line: preferenceStore.setValue(PreferenceConstants.P_OOBASEDIR, configuration.get(IOfficeApplication.APPLICATION_HOME_KEY).toString()); } System.out.println("NOAUIPlugin: internalStartApplication() end, returning status"); return status; }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java
License:Open Source License
private void createPageOverview(final AntTask task) { Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout);// w w w.j ava2 s.co m PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, JavaFXUIPlugin.PLUGIN_ID + ".JFXBuildConfigurationEditor_overview"); bean.setValue(task); toolkit = new FormToolkit(composite.getDisplay()); final Form form = toolkit.createForm(composite); form.setText("FX Build Configuration"); form.setImage(getTitleImage()); form.getBody().setLayout(new FillLayout()); toolkit.decorateFormHeading(form); initToolbar(form); ScrolledForm scrolledForm = toolkit.createScrolledForm(form.getBody()); scrolledForm.getBody().setLayout(new GridLayout(2, false)); Composite sectionParent = scrolledForm.getBody(); dbc = new DataBindingContext(); IWidgetValueProperty textModify = WidgetProperties.text(SWT.Modify); IWidgetValueProperty selChange = WidgetProperties.selection(); { Section section = toolkit.createSection(sectionParent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); section.setText("Build && Package Properties"); section.setDescription("The following properties are needed to build the JavaFX-Application"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite sectionClient = toolkit.createComposite(section); sectionClient.setLayout(new GridLayout(4, false)); { toolkit.createLabel(sectionClient, "Build Directory*:"); final Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); toolkit.createButton(sectionClient, "Filesystem ...", SWT.PUSH) .addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { String dir = handleBuildFilesystemDirectorySelection(t.getShell()); if (dir != null) { t.setText(dir); } } }); toolkit.createButton(sectionClient, "Workspace ...", SWT.PUSH) .addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { String dir = handleBuildWorkbenchDirectorySelection(t.getShell()); if (dir != null) { t.setText(dir); } } }); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ANT_TASK__BUILD_DIRECTORY); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Vendor name*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__INFO, INFO__VENDOR)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Application title*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__NAME)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Application version*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__VERSION)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Application class*:"); final Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); Button b = toolkit.createButton(sectionClient, "Browse ...", SWT.PUSH); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String name = handleRootclassSelection(t.getShell()); if (name != null) { t.setText(name); } } }); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__MAINCLASS)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Preloader class:"); final Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); Button b = toolkit.createButton(sectionClient, "Browse ...", SWT.PUSH); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String name = handlePreloaderclassSelection(t.getShell()); if (name != null) { t.setText(name); } } }); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__PRELOADERCLASS)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Splash:"); final Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); Button b = toolkit.createButton(sectionClient, "Browse ...", SWT.PUSH); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String name = handleSplashImage(t.getShell()); if (name != null) { t.setText(name); } } }); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__SPLASH_IMAGE)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Manifest-Attributes:") .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); Composite container = toolkit.createComposite(sectionClient); GridLayout gl = new GridLayout(2, false); gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0; container.setLayout(gl); GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL); gdContainer.horizontalSpan = 2; container.setLayoutData(gdContainer); Composite tableContainer = toolkit.createComposite(container); Table t = toolkit.createTable(tableContainer, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); t.setHeaderVisible(true); t.setLinesVisible(true); GridData gdTable = new GridData(GridData.FILL_HORIZONTAL); gdTable.heightHint = t.getHeaderHeight() + t.getItemHeight() * 5; tableContainer.setLayoutData(gdTable); TableColumnLayout tablelayout = new TableColumnLayout(); final TableViewer v = new TableViewer(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = t.getHeaderHeight() + t.getItemHeight() * 5; v.getControl().setLayoutData(gd); v.setContentProvider(ArrayContentProvider.getInstance()); { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { return ((Param) element).getName(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(33)); c.getColumn().setText("Name"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { return ((Param) element).getValue(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(67)); c.getColumn().setText("Value"); } tableContainer.setLayout(tablelayout); v.setInput(task.getManifestEntries()); Composite buttonComp = toolkit.createComposite(sectionClient); buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false)); buttonComp.setLayout(new GridLayout()); { Button b = toolkit.createButton(buttonComp, "Add ...", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (handleAddManifestAttr(getSite().getShell())) { v.setInput(task.getManifestEntries()); v.setSelection(new StructuredSelection( task.getManifestEntries().get(task.getManifestEntries().size() - 1))); } } }); } { Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Param value = (Param) ((IStructuredSelection) v.getSelection()).getFirstElement(); if (value != null) { if (handleRemoveManifestAttr(value)) { v.setInput(task.getManifestEntries()); } } else { MessageDialog.openWarning(getSite().getShell(), "Warning", "Please select an entry"); } } }); } { toolkit.createLabel(sectionClient, "Toolkit Type:") .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); ComboViewer c = new ComboViewer(sectionClient); c.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); c.setContentProvider(new ArrayContentProvider()); c.setInput(ApplicationToolkitType.VALUES); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__APPLICATION, APPLICATION__TOOLKIT)); dbc.bindValue(selChange.observe(c.getCombo()), prop.observeDetail(bean)); } { Button b = toolkit.createButton(sectionClient, "Convert CSS into binary form", SWT.CHECK); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 4, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__CSS_TO_BIN)); dbc.bindValue(selChange.observe(b), prop.observeDetail(bean)); } } section.setClient(sectionClient); } { Section section = toolkit.createSection(sectionParent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); section.setText("Building & Exporting"); section.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, true, 1, 2)); Composite sectionClient = toolkit.createComposite(section); sectionClient.setLayout(new GridLayout(1, false)); { FormText text = toolkit.createFormText(sectionClient, false); text.setText( "<p>To generate build instructions and export the project: <li style=\"bullet\" bindent=\"1\">Generate <a href=\"generateAnt\">ant build.xml</a> only</li><li style=\"bullet\" bindent=\"2\">Generate <a href=\"generateAndRun\">ant build.xml and run</a></li> </p>", true, false); text.addHyperlinkListener(new IHyperlinkListener() { @Override public void linkExited(final HyperlinkEvent e) { } @Override public void linkEntered(HyperlinkEvent e) { } @Override public void linkActivated(HyperlinkEvent e) { try { if ("generateAndRun".equals(e.getHref())) { executeExport(); } else { executeGenerateAnt(); } } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } section.setClient(sectionClient); } int index = addPage(composite); setPageText(index, "Overview"); }
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java
License:Open Source License
private void createPageDeploy(final AntTask task) { Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layout = new FillLayout(); composite.setLayout(layout);/*from w w w. java 2 s. c o m*/ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, JavaFXUIPlugin.PLUGIN_ID + ".JFXBuildConfigurationEditor_deploy"); // TODO final WritableValue bean = new WritableValue(); bean.setValue(task); toolkit = new FormToolkit(composite.getDisplay()); final Form form = toolkit.createForm(composite); form.setText("FX Build Configuration"); form.setImage(getTitleImage()); form.getBody().setLayout(new FillLayout()); toolkit.decorateFormHeading(form); initToolbar(form); ScrolledForm scrolledForm = toolkit.createScrolledForm(form.getBody()); scrolledForm.getBody().setLayout(new GridLayout(2, false)); Composite sectionParent = scrolledForm.getBody(); dbc = new DataBindingContext(); IWidgetValueProperty textModify = WidgetProperties.text(SWT.Modify); IWidgetValueProperty selChange = WidgetProperties.selection(); { Section section = toolkit.createSection(sectionParent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); section.setText("Deploy Properties"); section.setDescription("The following properties are needed to create a Java Webstart Deployment"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite sectionClient = toolkit.createComposite(section); final int COLUMN_COUNT = 3; sectionClient.setLayout(new GridLayout(COLUMN_COUNT, false)); { toolkit.createLabel(sectionClient, "Applet Width*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = COLUMN_COUNT - 1; t.setLayoutData(gd); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__WIDTH)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Applet Height*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = COLUMN_COUNT - 1; t.setLayoutData(gd); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__HEIGHT)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { Button b = toolkit.createButton(sectionClient, "Embed JNLP", SWT.CHECK); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__EMBEDJNLP)); dbc.bindValue(selChange.observe(b), prop.observeDetail(bean)); } { Button b = toolkit.createButton(sectionClient, "Treat files as extensions", SWT.CHECK); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__EXTENSION)); dbc.bindValue(selChange.observe(b), prop.observeDetail(bean)); } { Button b = toolkit.createButton(sectionClient, "Include deployment toolkit", SWT.CHECK); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__INCLUDE_DT)); dbc.bindValue(selChange.observe(b), prop.observeDetail(bean)); } { Button b = toolkit.createButton(sectionClient, "Native Package", SWT.CHECK); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__NATIVE_PACKAGE)); dbc.bindValue(selChange.observe(b), prop.observeDetail(bean)); } { Button b = toolkit.createButton(sectionClient, "Offline allowed", SWT.CHECK); b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, COLUMN_COUNT, 1)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__OFFLINE_ALLOWED)); dbc.bindValue(selChange.observe(b), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Placeholder Ref.*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = COLUMN_COUNT - 1; t.setLayoutData(gd); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__PLACEHOLDERREF)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Placeholder ID*:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = COLUMN_COUNT - 1; t.setLayoutData(gd); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__PLACEHOLDERID)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "HTML Template:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__TEMPLATE, TEMPLATE__FILE)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); Button b = toolkit.createButton(sectionClient, "Workspace ...", SWT.NONE); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { FilteredResourcesSelectionDialog d = new FilteredResourcesSelectionDialog( getSite().getShell(), false, ((IFileEditorInput) getEditorInput()).getFile().getProject(), IResource.FILE) { @Override protected IStatus validateItem(final Object item) { IFile f = (IFile) item; if (f.getParent() instanceof IProject) { return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource has to be part of the source folder"); } if (!f.getName().endsWith(JavaFXUIPlugin.FILEEXTENSION_HTML_TEMPLATE)) { return new Status(IStatus.ERROR, JavaFXUIPlugin.PLUGIN_ID, "The selected resource does not seem to be a html file"); } return super.validateItem(item); } }; if (d.open() == ResourceSelectionDialog.OK) { Object[] rv = d.getResult(); if (rv.length == 1) { IFile f = (IFile) rv[0]; IJavaElement j = JavaCore.create(f.getParent()); String template = null; if (j instanceof IPackageFragment) { IPackageFragment p = (IPackageFragment) j; template = p.getElementName().replace('.', '/') + "/" + f.getName(); } else if (j instanceof IPackageFragmentRoot) { IPackageFragmentRoot p = (IPackageFragmentRoot) j; template = f.getName(); } else { MessageDialog.openInformation(getSite().getShell(), "Not valid", "The selected resource has to be part of the source folder"); } if (template != null) { if (getTask().getDeploy().getTemplate() == null) { Command cmd = new SetCommand(editingDomain, getTask().getDeploy(), DEPLOY__TEMPLATE, ParametersFactory.eINSTANCE.createTemplate()); if (cmd.canExecute()) { cmd.execute(); } } Command cmd = new SetCommand(editingDomain, getTask().getDeploy().getTemplate(), TEMPLATE__FILE, template); if (cmd.canExecute()) { cmd.execute(); } } } } } }); } { toolkit.createLabel(sectionClient, "Template Output File:"); Text t = toolkit.createText(sectionClient, "", SWT.BORDER); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = COLUMN_COUNT - 1; t.setLayoutData(gd); IEMFValueProperty prop = EMFEditProperties.value(editingDomain, FeaturePath.fromList(ANT_TASK__DEPLOY, DEPLOY__TEMPLATE, TEMPLATE__TO_FILE)); dbc.bindValue(textModify.observeDelayed(DELAY, t), prop.observeDetail(bean)); } { toolkit.createLabel(sectionClient, "Webstart Splash:") .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); Composite container = toolkit.createComposite(sectionClient); GridLayout gl = new GridLayout(2, false); gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0; container.setLayout(gl); GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL); gdContainer.horizontalSpan = COLUMN_COUNT - 1; container.setLayoutData(gdContainer); Composite tableContainer = toolkit.createComposite(container); Table t = toolkit.createTable(tableContainer, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); t.setHeaderVisible(true); t.setLinesVisible(true); GridData gdTable = new GridData(GridData.FILL_HORIZONTAL); gdTable.heightHint = t.getItemHeight() * 5; tableContainer.setLayoutData(gdTable); TableColumnLayout tablelayout = new TableColumnLayout(); final TableViewer v = new TableViewer(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = t.getItemHeight() * 5; v.getControl().setLayoutData(gd); v.setContentProvider(ArrayContentProvider.getInstance()); { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { return ((Splash) element).getMode().getName(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 100, false)); c.getColumn().setText("Mode"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(final Object element) { return ((Splash) element).getHref(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(90)); c.getColumn().setText("URL"); } tableContainer.setLayout(tablelayout); v.setInput(task.getDeploy().getInfo().getSplash()); Composite buttonComp = toolkit.createComposite(container); buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false)); buttonComp.setLayout(new GridLayout()); { Button b = toolkit.createButton(buttonComp, "Add ...", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (handleAddSplash()) { v.setInput(task.getDeploy().getInfo().getSplash()); v.setSelection(new StructuredSelection(task.getDeploy().getInfo().getSplash() .get(task.getDeploy().getInfo().getSplash().size() - 1))); } } }); } { Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Splash value = (Splash) ((IStructuredSelection) v.getSelection()).getFirstElement(); if (value != null) { if (handleRemoveSplash(value)) { v.setInput(getTask().getDeploy().getInfo().getSplash()); } } else { MessageDialog.openWarning(getSite().getShell(), "Warning", "Please select an entry"); } } }); } } { toolkit.createLabel(sectionClient, "Webstart Icons:") .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); Composite container = toolkit.createComposite(sectionClient); GridLayout gl = new GridLayout(2, false); gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0; container.setLayout(gl); GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL); gdContainer.horizontalSpan = COLUMN_COUNT - 1; container.setLayoutData(gdContainer); Composite tableContainer = toolkit.createComposite(container); Table t = toolkit.createTable(tableContainer, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); t.setHeaderVisible(true); t.setLinesVisible(true); GridData gdTable = new GridData(GridData.FILL_HORIZONTAL); gdTable.heightHint = t.getItemHeight() * 5; tableContainer.setLayoutData(gdTable); TableColumnLayout tablelayout = new TableColumnLayout(); final TableViewer v = new TableViewer(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = t.getItemHeight() * 5; v.getControl().setLayoutData(gd); v.setContentProvider(ArrayContentProvider.getInstance()); { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((Icon) element).getDepth(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 50, false)); c.getColumn().setText("Depth"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((Icon) element).getKind().getName(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 100, false)); c.getColumn().setText("Kind"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((Icon) element).getWidth(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 50, false)); c.getColumn().setText("Width"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((Icon) element).getHeight(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(10, 50, false)); c.getColumn().setText("Height"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((Icon) element).getHref(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(60)); c.getColumn().setText("Url"); } tableContainer.setLayout(tablelayout); v.setInput(task.getDeploy().getInfo().getIcon()); Composite buttonComp = toolkit.createComposite(container); buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false)); buttonComp.setLayout(new GridLayout()); { Button b = toolkit.createButton(buttonComp, "Add ...", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (handleAddIcon()) { v.setInput(task.getDeploy().getInfo().getIcon()); v.setSelection(new StructuredSelection(task.getDeploy().getInfo().getIcon() .get(task.getDeploy().getInfo().getIcon().size() - 1))); } } }); } { Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Icon value = (Icon) ((IStructuredSelection) v.getSelection()).getFirstElement(); if (value != null) { if (handleRemoveIcon(value)) { v.setInput(task.getDeploy().getInfo().getIcon()); } } else { MessageDialog.openWarning(getSite().getShell(), "Warning", "Please select an entry"); } } }); } } { toolkit.createLabel(sectionClient, "Additional META-INF files:") .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); Composite container = toolkit.createComposite(sectionClient); GridLayout gl = new GridLayout(2, false); gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0; container.setLayout(gl); GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL); gdContainer.horizontalSpan = COLUMN_COUNT - 1; container.setLayoutData(gdContainer); Composite tableContainer = toolkit.createComposite(container); Table t = toolkit.createTable(tableContainer, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); t.setHeaderVisible(true); t.setLinesVisible(true); GridData gdTable = new GridData(GridData.FILL_HORIZONTAL); gdTable.heightHint = t.getItemHeight() * 5; tableContainer.setLayoutData(gdTable); TableColumnLayout tablelayout = new TableColumnLayout(); final TableViewer v = new TableViewer(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = t.getItemHeight() * 5; v.getControl().setLayoutData(gd); v.setContentProvider(ArrayContentProvider.getInstance()); { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((KeyValuePair) element).getKey(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(33)); c.getColumn().setText("Folder"); } { TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((KeyValuePair) element).getValue(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(67)); c.getColumn().setText("File"); } tableContainer.setLayout(tablelayout); v.setInput(task.getFiles()); Composite buttonComp = toolkit.createComposite(container); buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false)); buttonComp.setLayout(new GridLayout()); { Button b = toolkit.createButton(buttonComp, "Add ...", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (handleAddMetaInfFile()) { v.setInput(task.getFiles()); v.setSelection( new StructuredSelection(task.getFiles().get(task.getFiles().size() - 1))); } } }); } { Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { KeyValuePair value = (KeyValuePair) ((IStructuredSelection) v.getSelection()) .getFirstElement(); if (value != null) { if (handleRemoveMetaInfFile(value)) { v.setInput(task.getFiles()); } } else { MessageDialog.openWarning(getSite().getShell(), "Warning", "Please select an entry"); } } }); } } { toolkit.createLabel(sectionClient, "Fonts:") .setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false)); Composite container = toolkit.createComposite(sectionClient); GridLayout gl = new GridLayout(2, false); gl.marginBottom = gl.marginHeight = gl.marginLeft = gl.marginRight = gl.marginTop = gl.marginWidth = 0; container.setLayout(gl); GridData gdContainer = new GridData(GridData.FILL_HORIZONTAL); gdContainer.horizontalSpan = COLUMN_COUNT - 1; container.setLayoutData(gdContainer); Composite tableContainer = toolkit.createComposite(container); Table t = toolkit.createTable(tableContainer, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); t.setHeaderVisible(true); t.setLinesVisible(true); GridData gdTable = new GridData(GridData.FILL_HORIZONTAL); gdTable.heightHint = t.getItemHeight() * 5; tableContainer.setLayoutData(gdTable); TableColumnLayout tablelayout = new TableColumnLayout(); final TableViewer v = new TableViewer(t); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = t.getItemHeight() * 5; v.getControl().setLayoutData(gd); final ArrayContentProvider cp = new ArrayContentProvider(); v.setContentProvider(cp); { IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ParametersPackage.Literals.KEY_VALUE_PAIR__KEY); TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); TableColumn tc = c.getColumn(); tc.setText("Font name"); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((KeyValuePair) element).getKey(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(33)); } { IEMFValueProperty prop = EMFEditProperties.value(editingDomain, ParametersPackage.Literals.KEY_VALUE_PAIR__VALUE); TableViewerColumn c = new TableViewerColumn(v, SWT.NONE); TableColumn tc = c.getColumn(); tc.setText("File"); c.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { return ((KeyValuePair) element).getValue(); } }); tablelayout.setColumnData(c.getColumn(), new ColumnWeightData(67)); } tableContainer.setLayout(tablelayout); v.setInput(task.getFonts()); Composite buttonComp = toolkit.createComposite(container); buttonComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false)); buttonComp.setLayout(new GridLayout()); { Button b = toolkit.createButton(buttonComp, "Add ...", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { if (handleAddFont()) { final KeyValuePair newFont = task.getFonts().get(task.getFonts().size() - 1); v.refresh(); v.setSelection(new StructuredSelection(newFont)); } } }); } { Button b = toolkit.createButton(buttonComp, "Remove", SWT.PUSH); b.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false)); b.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { KeyValuePair value = (KeyValuePair) ((IStructuredSelection) v.getSelection()) .getFirstElement(); if (value != null) { if (handleRemoveFont(value)) { v.setInput(task.getFonts()); } } else { MessageDialog.openWarning(getSite().getShell(), "Warning", "Please select an entry"); } } }); } } section.setClient(sectionClient); } int index = addPage(composite); setPageText(index, "Deploy"); }