List of usage examples for org.eclipse.jface.resource ImageDescriptor createFromURL
public static ImageDescriptor createFromURL(URL url)
From source file:eu.geclipse.jsdl.ui.internal.dialogs.DataStagingInDialog.java
License:Open Source License
@Override protected Control createDialogArea(final Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite panel = new Composite(composite, SWT.NONE); initializeDialogUnits(composite);//from ww w.j a v a 2 s .c o m GridData gd; GridLayout gLayout = new GridLayout(3, false); panel.setLayout(gLayout); gd = new GridData(GridData.FILL_HORIZONTAL); panel.setLayoutData(gd); Label pathLabel = new Label(panel, SWT.LEAD); pathLabel.setText(Messages.getString("DataStageInDialog.source_location_field_label")); //$NON-NLS-1$ gd = new GridData(); pathLabel.setLayoutData(gd); this.pathText = new Text(panel, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); this.pathText.setLayoutData(gd); if (this.dataStagingType != null) { this.pathText.setText(this.dataStagingType.getSource().getURI()); } this.pathText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { if (DataStagingInDialog.this.editMode == true) { try { DataStagingInDialog.this.uris[0] = URI.create(DataStagingInDialog.this.pathText.getText()); } catch (IllegalArgumentException exc) { //ignore } } } }); Button browseButton = new Button(panel, SWT.PUSH); // IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); URL openFileIcon = Activator.getDefault().getBundle().getEntry("icons/obj16/open_file.gif"); //$NON-NLS-1$ Image openFileImage = ImageDescriptor.createFromURL(openFileIcon).createImage(); browseButton.setImage(openFileImage); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { String currentURI = null; GridFileDialog dialog = new GridFileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), GridFileDialog.STYLE_ALLOW_ONLY_FILES | GridFileDialog.STYLE_MULTI_SELECTION); if (dialog.open() == Window.OK) { DataStagingInDialog.this.uris = dialog.getSelectedURIs(); for (int j = 0; j < DataStagingInDialog.this.uris.length; j++) { URI uri = DataStagingInDialog.this.uris[j]; String query = uri.getQuery(); if (query != null && query.trim().length() > 0) { String[] qParts = query.split("&"); //$NON-NLS-1$ query = ""; //$NON-NLS-1$ for (int i = 0; i < qParts.length; i++) { String qPart = qParts[i]; if (!qPart.startsWith("vo")) { //$NON-NLS-1$ if (query.trim().length() > 0) { query += "&"; //$NON-NLS-1$ } query += qPart; } } if (query.trim().length() == 0) { query = null; } } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment()); DataStagingInDialog.this.uris[j] = uri; } catch (URISyntaxException e) { //TODO } } DataStagingInDialog.this.filename = new String[DataStagingInDialog.this.uris.length]; if ((DataStagingInDialog.this.uris != null) && (DataStagingInDialog.this.uris.length > 0)) { for (int i = 0; i < DataStagingInDialog.this.uris.length; i++) { currentURI = DataStagingInDialog.this.uris[i].toString(); URI uri; try { uri = new URI(currentURI); DataStagingInDialog.this.filename[i] = new Path(uri.getPath()).lastSegment(); } catch (URISyntaxException e) { //TODO Activator.logException(e); } if (i == 0) { DataStagingInDialog.this.pathText .setText(DataStagingInDialog.this.uris[i].toString()); /* * If in edit mode , then change only the source location and not the Stage-in Name. * */ if ((!DataStagingInDialog.this.editMode)) { DataStagingInDialog.this.nameText.setText(DataStagingInDialog.this.filename[i]); } } else { DataStagingInDialog.this.pathText .setText(DataStagingInDialog.this.pathText.getText() + ", " //$NON-NLS-1$ + DataStagingInDialog.this.uris[i].toString()); DataStagingInDialog.this.nameText .setText(DataStagingInDialog.this.nameText.getText() + ", " //$NON-NLS-1$ + DataStagingInDialog.this.filename[i]); } } } } updateButtons(); } }); Label nameLabel = new Label(panel, SWT.LEAD); nameLabel.setText(Messages.getString("DataStageInDialog.name_field_label")); //$NON-NLS-1$ nameLabel.setLayoutData(new GridData()); this.nameText = new Text(panel, SWT.BORDER); gd = new GridData(); gd.widthHint = 260; gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.FILL; this.nameText.setLayoutData(gd); if (this.dataStagingType != null) { this.nameText.setText(this.dataStagingType.getFileName()); } this.nameText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { if (DataStagingInDialog.this.editMode == true) { DataStagingInDialog.this.filename[0] = DataStagingInDialog.this.nameText.getText(); } } }); if (this.dialogStyle == DataStagingInDialog.ADVANCED_DIALOG) { gd = new GridData(); Label creationFlagLabel = new Label(panel, SWT.LEAD); creationFlagLabel.setText(Messages.getString("DataStageInTable.CreationFlag_field_label")); //$NON-NLS-1$ creationFlagLabel.setLayoutData(gd); this.creationFlagCombo = new Combo(panel, SWT.BORDER | SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); gd = new GridData(); gd.widthHint = 260; gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.FILL; this.creationFlagCombo.setLayoutData(gd); /* Populate the Combo Box with the Creation Flag Literals */ EEnum cFEnum = JsdlPackage.Literals.CREATION_FLAG_ENUMERATION; for (int i = 0; i < cFEnum.getELiterals().size(); i++) { this.creationFlagCombo.add(cFEnum.getEEnumLiteral(i).toString()); } cFEnum = null; int indexOfOverwite; if (this.dataStagingType != null) { indexOfOverwite = this.creationFlagCombo .indexOf(this.dataStagingType.getCreationFlag().getLiteral()); this.creationFlagCombo.select(indexOfOverwite); } else { indexOfOverwite = this.creationFlagCombo.indexOf("overwrite"); //$NON-NLS-1$ this.creationFlagCombo.select(indexOfOverwite); } gd = new GridData(); Label deleteOnTerminationLabel = new Label(panel, SWT.LEAD); deleteOnTerminationLabel .setText(Messages.getString("DataStageInTable.DeleteOnTermination_field_label")); //$NON-NLS-1$ deleteOnTerminationLabel.setLayoutData(gd); this.deleteOnTerminationCombo = new Combo(panel, SWT.BORDER | SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); /* Populate the Combo Box with the Delete On Termination Literals */ this.deleteOnTerminationCombo.add("true"); //$NON-NLS-1$ this.deleteOnTerminationCombo.add("false"); //$NON-NLS-1$ if (this.dataStagingType != null) { int indexOfDelete = this.deleteOnTerminationCombo .indexOf(Boolean.toString(this.dataStagingType.isDeleteOnTermination())); this.deleteOnTerminationCombo.select(indexOfDelete); } else { this.deleteOnTerminationCombo.select(0); } gd = new GridData(); gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.FILL; this.deleteOnTerminationCombo.setLayoutData(gd); } ModifyListener listener = new UpdateAdapter(); this.nameText.addModifyListener(listener); this.pathText.addModifyListener(listener); return composite; }
From source file:eu.geclipse.jsdl.ui.internal.dialogs.DataStagingOutDialog.java
License:Open Source License
@Override protected Control createDialogArea(final Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new GridLayout(1, false)); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite panel = new Composite(composite, SWT.NONE); initializeDialogUnits(composite);//from w w w.ja va 2s .com GridData gd; GridLayout gLayout = new GridLayout(3, false); panel.setLayout(gLayout); gd = new GridData(GridData.FILL_HORIZONTAL); panel.setLayoutData(gd); Label nameLabel = new Label(panel, SWT.LEAD); nameLabel.setText(Messages.getString("DataStageInDialog.name_field_label")); //$NON-NLS-1$ nameLabel.setLayoutData(new GridData()); this.nameText = new Text(panel, SWT.BORDER); gd = new GridData(); gd.widthHint = 260; gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.FILL; this.nameText.setLayoutData(gd); if (this.dataStagingType != null) { this.nameText.setText(this.dataStagingType.getFileName()); } this.nameText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { if (DataStagingOutDialog.this.editMode == true) { DataStagingOutDialog.this.filename[0] = DataStagingOutDialog.this.nameText.getText(); } } }); Label pathLabel = new Label(panel, SWT.LEAD); pathLabel.setText(Messages.getString("DataStageInDialog.target_location_field_label")); //$NON-NLS-1$ gd = new GridData(); pathLabel.setLayoutData(gd); this.pathText = new Text(panel, SWT.BORDER); if (this.dataStagingType != null) { this.pathText.setText(this.dataStagingType.getTarget().getURI()); } this.pathText.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { if (DataStagingOutDialog.this.editMode == true) { try { DataStagingOutDialog.this.uris[0] = URI .create(DataStagingOutDialog.this.pathText.getText()); } catch (IllegalArgumentException exc) { // ignore } } } }); gd = new GridData(GridData.FILL_HORIZONTAL); this.pathText.setLayoutData(gd); Button browseButton = new Button(panel, SWT.PUSH); URL openFileIcon = Activator.getDefault().getBundle().getEntry("icons/obj16/open_file.gif"); //$NON-NLS-1$ Image openFileImage = ImageDescriptor.createFromURL(openFileIcon).createImage(); browseButton.setImage(openFileImage); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { String currentURI = null; GridFileDialog dialog = new GridFileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), GridFileDialog.STYLE_ALLOW_ONLY_FILES); if (dialog.open() == Window.OK) { DataStagingOutDialog.this.uris = dialog.getSelectedURIs(); for (int j = 0; j < DataStagingOutDialog.this.uris.length; j++) { URI uri = DataStagingOutDialog.this.uris[j]; String query = uri.getQuery(); if (query != null && query.trim().length() > 0) { String[] qParts = query.split("&"); //$NON-NLS-1$ query = ""; //$NON-NLS-1$ for (int i = 0; i < qParts.length; i++) { String qPart = qParts[i]; if (!qPart.startsWith("vo")) { //$NON-NLS-1$ if (query.trim().length() > 0) { query += "&"; //$NON-NLS-1$ } query += qPart; } } if (query.trim().length() == 0) { query = null; } } try { uri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment()); DataStagingOutDialog.this.uris[j] = uri; } catch (URISyntaxException e1) { // TODO Activator.logException(e1); } } if ((DataStagingOutDialog.this.uris != null) && (DataStagingOutDialog.this.uris.length > 0)) { DataStagingOutDialog.this.filename = new String[DataStagingOutDialog.this.uris.length]; for (int i = 0; i < DataStagingOutDialog.this.uris.length; i++) { currentURI = DataStagingOutDialog.this.uris[i].toString(); URI uri; try { uri = new URI(currentURI); DataStagingOutDialog.this.filename[i] = new Path(uri.getPath()).lastSegment(); } catch (URISyntaxException e1) { // TODO Activator.logException(e1); } if (i == 0) { DataStagingOutDialog.this.pathText .setText(DataStagingOutDialog.this.uris[i].toString()); /* * If in edit mode , then change only the source location and * not the Stage-in Name. */ if ((!DataStagingOutDialog.this.editMode)) { DataStagingOutDialog.this.nameText .setText(DataStagingOutDialog.this.filename[i]); } } else { DataStagingOutDialog.this.pathText .setText(DataStagingOutDialog.this.pathText.getText() + ", " //$NON-NLS-1$ + DataStagingOutDialog.this.uris[i].toString()); DataStagingOutDialog.this.nameText .setText(DataStagingOutDialog.this.nameText.getText() + ", " //$NON-NLS-1$ + DataStagingOutDialog.this.filename[i]); } } } } updateButtons(); } }); if (this.dialogStyle == DataStagingInDialog.ADVANCED_DIALOG) { gd = new GridData(); Label creationFlagLabel = new Label(panel, SWT.LEAD); creationFlagLabel.setText(Messages.getString("DataStageInTable.CreationFlag_field_label")); //$NON-NLS-1$ creationFlagLabel.setLayoutData(gd); this.creationFlagCombo = new Combo(panel, SWT.BORDER | SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); gd = new GridData(); gd.widthHint = 260; gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.FILL; this.creationFlagCombo.setLayoutData(gd); /* Populate the Combo Box with the Creation Flag Literals */ EEnum cFEnum = JsdlPackage.Literals.CREATION_FLAG_ENUMERATION; for (int i = 0; i < cFEnum.getELiterals().size(); i++) { this.creationFlagCombo.add(cFEnum.getEEnumLiteral(i).toString()); } int indexOfOverwite; if (this.dataStagingType != null) { indexOfOverwite = this.creationFlagCombo .indexOf(this.dataStagingType.getCreationFlag().getLiteral()); this.creationFlagCombo.select(indexOfOverwite); } else { indexOfOverwite = this.creationFlagCombo.indexOf("overwrite"); //$NON-NLS-1$ this.creationFlagCombo.select(indexOfOverwite); } gd = new GridData(); Label deleteOnTerminationLabel = new Label(panel, SWT.LEAD); deleteOnTerminationLabel .setText(Messages.getString("DataStageInTable.DeleteOnTermination_field_label")); //$NON-NLS-1$ deleteOnTerminationLabel.setLayoutData(gd); this.deleteOnTerminationCombo = new Combo(panel, SWT.BORDER | SWT.SIMPLE | SWT.DROP_DOWN | SWT.READ_ONLY); /* Populate the Combo Box with the Delete On Termination Literals */ this.deleteOnTerminationCombo.add("true"); //$NON-NLS-1$ this.deleteOnTerminationCombo.add("false"); //$NON-NLS-1$ if (this.dataStagingType != null) { int indexOfDelete = this.deleteOnTerminationCombo .indexOf(Boolean.toString(this.dataStagingType.isDeleteOnTermination())); this.deleteOnTerminationCombo.select(indexOfDelete); } else { this.deleteOnTerminationCombo.select(0); } gd = new GridData(); gd.horizontalSpan = 2; gd.horizontalAlignment = SWT.FILL; this.deleteOnTerminationCombo.setLayoutData(gd); } ModifyListener listener = new UpdateAdapter(); this.nameText.addModifyListener(listener); this.pathText.addModifyListener(listener); return composite; }
From source file:eu.geclipse.jsdl.ui.internal.pages.JsdlFormPage.java
License:Open Source License
protected void addFormPageHelp(final ScrolledForm form) { final String href = getHelpResource(); if (href != null) { IToolBarManager manager = form.getToolBarManager(); Action helpAction = new Action("help") { //$NON-NLS-1$ @Override//from w ww .j a v a 2 s . c o m public void run() { BusyIndicator.showWhile(form.getDisplay(), new Runnable() { public void run() { PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(href); } }); } }; helpAction.setToolTipText(Messages.getString("JsdlEditorPage_HelpToolTip")); //$NON-NLS-1$ URL stageInURL = Activator.getDefault().getBundle().getEntry("icons/help.gif"); //$NON-NLS-1$ this.helpDesc = ImageDescriptor.createFromURL(stageInURL); helpAction.setImageDescriptor(this.helpDesc); manager.add(helpAction); form.updateToolBar(); } }
From source file:eu.geclipse.jsdl.ui.providers.DataStageInLabelProvider.java
License:Open Source License
void loadImages() { URL stageInURL = Activator.getDefault().getBundle().getEntry("icons/stage-in.gif"); //$NON-NLS-1$ URL stageInOutURL = Activator.getDefault().getBundle().getEntry("icons/stage-in-out.gif"); //$NON-NLS-1$ ImageDescriptor stageInDesc = ImageDescriptor.createFromURL(stageInURL); ImageDescriptor stageInOutDesc = ImageDescriptor.createFromURL(stageInOutURL); this.stageInImage = stageInDesc.createImage(); this.stageInOutImage = stageInOutDesc.createImage(); }
From source file:eu.geclipse.jsdl.ui.providers.DataStageOutLabelProvider.java
License:Open Source License
void loadImages() { URL stageOutURL = Activator.getDefault().getBundle().getEntry("icons/stage-out.gif"); //$NON-NLS-1$ URL stageInOutURL = Activator.getDefault().getBundle().getEntry("icons/stage-in-out.gif"); //$NON-NLS-1$ ImageDescriptor stageOutDesc = ImageDescriptor.createFromURL(stageOutURL); ImageDescriptor stageInOutDesc = ImageDescriptor.createFromURL(stageInOutURL); this.stageOutImage = stageOutDesc.createImage(); this.stageInOutImage = stageInOutDesc.createImage(); }
From source file:eu.geclipse.jsdl.ui.providers.FeatureLabelProvider.java
License:Open Source License
void loadImages() { URL argsURL = Activator.getDefault().getBundle().getEntry("icons/args.gif"); //$NON-NLS-1$ URL candHostsURL = Activator.getDefault().getBundle().getEntry("icons/computing_obj.gif"); //$NON-NLS-1$ URL projectsURL = Activator.getDefault().getBundle().getEntry("icons/gridprojects.gif"); //$NON-NLS-1$ URL annotationURL = Activator.getDefault().getBundle().getEntry("icons/annotation_obj.gif"); //$NON-NLS-1$ ImageDescriptor argsDesc = ImageDescriptor.createFromURL(argsURL); ImageDescriptor candHostsDesc = ImageDescriptor.createFromURL(candHostsURL); ImageDescriptor projectsDesc = ImageDescriptor.createFromURL(projectsURL); ImageDescriptor annotDesc = ImageDescriptor.createFromURL(annotationURL); this.argsImage = argsDesc.createImage(); this.candHostsImage = candHostsDesc.createImage(); this.projectsImage = projectsDesc.createImage(); this.annotationImage = annotDesc.createImage(); }
From source file:eu.geclipse.jsdl.ui.wizards.ExecutableNewJobWizardPage.java
License:Open Source License
public void createControl(final Composite parent) { this.parentP = parent; // mainComposite Composite mainComp = new Composite(parent, SWT.NONE); IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); URL openFileIcon = Activator.getDefault().getBundle().getEntry("icons/obj16/open_file.gif"); //$NON-NLS-1$ Image openFileImage = ImageDescriptor.createFromURL(openFileIcon).createImage(); GridLayout gLayout = new GridLayout(3, false); gLayout.horizontalSpacing = 10;/*www.j a v a 2 s. c o m*/ gLayout.verticalSpacing = 12; mainComp.setLayout(gLayout); // Label for application name GridData layout = new GridData(); Label applicationNameLabel = new Label(mainComp, GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); applicationNameLabel.setText(Messages.getString("ExecutableNewJobWizardPage.application_name_label")); //$NON-NLS-1$ layout = new GridData(); layout.horizontalAlignment = GridData.FILL; applicationNameLabel.setLayoutData(layout); // Combo - application name this.applicationName = new CCombo(mainComp, SWT.BORDER); layout = new GridData(); layout.horizontalAlignment = GridData.FILL; layout.horizontalSpan = 2; this.applicationName.setLayoutData(layout); this.applicationName.addModifyListener(this); this.applicationName.addFocusListener(new FocusListener() { public void focusGained(final FocusEvent e) { if (ExecutableNewJobWizardPage.this.firstTime) { fetchApps(ExecutableNewJobWizardPage.this.virtualOrg); ExecutableNewJobWizardPage.this.applicationName.setListVisible(true); } } public void focusLost(final FocusEvent e) { // do nothing } }); // Label - executable file Label inputLabel = new Label(mainComp, GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER); inputLabel.setText(Messages.getString("ExecutableNewJobWizardPage.exe_input_label")); //$NON-NLS-1$ layout = new GridData(); layout.horizontalAlignment = GridData.FILL; inputLabel.setLayoutData(layout); // Stored combo - executable file this.executableFile = new StoredCombo(mainComp, SWT.DROP_DOWN); this.executableFile.setPreferences(prefs, INPUT_EXE_ID); this.executableFile.setText(""); //$NON-NLS-1$ layout = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER); this.executableFile.setLayoutData(layout); this.executableFile.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent event) { if (ExecutableNewJobWizardPage.this.executableFile.getText().equals("")) { //$NON-NLS-1$ setStdFilesGroupEnabled(false); } else { setStdFilesGroupEnabled(true); } } }); // Button - browsing for executable file this.gridFileDialogButton = new Button(mainComp, SWT.PUSH); this.gridFileDialogButton.setImage(openFileImage); layout = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); this.gridFileDialogButton.setLayoutData(layout); this.gridFileDialogButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { GridFileDialog dialog = new GridFileDialog(getShell(), GridFileDialog.STYLE_ALLOW_ONLY_EXISTING | GridFileDialog.STYLE_ALLOW_ONLY_FILES); if (dialog.open() == Window.OK) { URI[] uris = dialog.getSelectedURIs(); if ((uris != null) && (uris.length > 0)) { ExecutableNewJobWizardPage.this.executableFile.setText(uris[0].toString()); } else { ExecutableNewJobWizardPage.this.executableFile.setText(""); //$NON-NLS-1$ } } } }); // Label - arguments list Label argumentsLabel = new Label(mainComp, SWT.LEAD); argumentsLabel.setText(Messages.getString("ExecutableNewJobWizardPage.arguments_line_label")); //$NON-NLS-1$ layout = new GridData(); argumentsLabel.setLayoutData(layout); // Text - arguments list this.argumentsLine = new Text(mainComp, SWT.BORDER); layout = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); layout.horizontalSpan = 2; this.argumentsLine.setLayoutData(layout); // Group - std files group this.stdFilesGroup = new Group(mainComp, SWT.NONE); this.stdFilesGroup.setToolTipText(STD_FILES_TOOL_TIP); this.stdFilesGroup.setText(Messages.getString("ExecutableNewJobWizardPage.composite_group_title")); //$NON-NLS-1$ this.stdFilesGroup.setLayout(new GridLayout(3, false)); layout = new GridData(GridData.FILL_HORIZONTAL); layout.grabExcessHorizontalSpace = true; layout.horizontalSpan = 3; this.stdFilesGroup.setLayoutData(layout); // Label - stdin file Label stdinLabel = new Label(this.stdFilesGroup, SWT.LEAD); layout = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING); stdinLabel.setLayoutData(layout); stdinLabel.setText(Messages.getString("FilesInputNewJobWizardPage.stdin_label")); //$NON-NLS-1$ // Text - stdin file this.stdin = new Text(this.stdFilesGroup, SWT.NONE | SWT.BORDER); layout = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_CENTER); this.stdin.setLayoutData(layout); // Button - browsing for stdin file this.chooseButton = new Button(this.stdFilesGroup, SWT.PUSH); this.chooseButton.setImage(openFileImage); layout = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); this.chooseButton.setLayoutData(layout); this.chooseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { GridFileDialog dialog = new GridFileDialog(getShell(), GridFileDialog.STYLE_ALLOW_ONLY_FILES | GridFileDialog.STYLE_ALLOW_ONLY_EXISTING); if (dialog.open() == Window.OK) { URI[] uris = getUrisFromDialog(dialog); if ((uris != null) && (uris.length > 0)) { ExecutableNewJobWizardPage.this.stdin.setText(uris[0].toString()); } } } }); // Label - stdout file Label stdoutLabel = new Label(this.stdFilesGroup, SWT.NONE); layout = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING); stdoutLabel.setLayoutData(layout); stdoutLabel.setText(Messages.getString("FilesInputNewJobWizardPage.stdout_label")); //$NON-NLS-1$ // Text - stdout file this.stdout = new Text(this.stdFilesGroup, SWT.NONE | SWT.BORDER); layout = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_CENTER); this.stdout.setLayoutData(layout); // Button - browsing for stdout files (only remote) this.outButton = new Button(this.stdFilesGroup, SWT.PUSH); this.outButton.setImage(openFileImage); layout = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); this.outButton.setLayoutData(layout); this.outButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { GridFileDialog dialog = new GridFileDialog(getShell(), GridFileDialog.STYLE_ALLOW_ONLY_FILES); if (dialog.open() == Window.OK) { URI[] uris = getUrisFromDialog(dialog); if ((uris != null) && ((uris.length > 0))) { ExecutableNewJobWizardPage.this.stdout.setText(uris[0].toString()); } } } }); // Label - stderr file Label stderrLabel = new Label(this.stdFilesGroup, SWT.NONE); layout = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_BEGINNING); stderrLabel.setLayoutData(layout); stderrLabel.setText(Messages.getString("FilesInputNewJobWizardPage.stderr_label")); //$NON-NLS-1$ // Text - stderr file (only remote) this.stderr = new Text(this.stdFilesGroup, SWT.NONE | SWT.BORDER); layout = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_CENTER | GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); this.stderr.setLayoutData(layout); // Button - browsing for stderr file (only remote) this.errButton = new Button(this.stdFilesGroup, SWT.PUSH); this.errButton.setImage(openFileImage); layout = new GridData( GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); this.errButton.setLayoutData(layout); this.errButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { GridFileDialog dialog = new GridFileDialog(getShell(), GridFileDialog.STYLE_ALLOW_ONLY_FILES); if (dialog.open() == Window.OK) { URI[] uris = getUrisFromDialog(dialog); if ((uris != null) && (uris.length > 0)) { ExecutableNewJobWizardPage.this.stderr.setText(uris[0].toString()); } } } }); if (this.basicNode == null) { this.basicNode = new BasicWizardPart(this.internalPages, getWizard()); } setSelectedNode(this.basicNode); setStdFilesGroupEnabled(false); setControl(mainComp); }
From source file:eu.geclipse.servicejob.ui.views.ServiceJobView.java
License:Open Source License
private void createButtons() { IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); this.wizardAction = new OpenServiceJobDialogAction(); this.wizardAction.setToolTipText(Messages.getString("ServiceJobsView.new_operators_job_wizard")); //$NON-NLS-1$ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); this.wizardAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD)); URL runURL = Activator.getDefault().getBundle().getEntry("icons/obj16/debugt_obj.gif"); //$NON-NLS-1$ ImageDescriptor runDesc = ImageDescriptor.createFromURL(runURL); URL runDisabledURL = Activator.getDefault().getBundle().getEntry("icons/obj16/debugt_obj_disabled1.gif"); //$NON-NLS-1$ ImageDescriptor runDisabledDesc = ImageDescriptor.createFromURL(runDisabledURL); this.runJobAction = new Action() { @Override/* w w w . j a v a 2 s. c o m*/ public void run() { ISelection sel = ServiceJobView.this.getSelection(); if (!sel.isEmpty()) { if (sel instanceof IStructuredSelection) { IStructuredSelection sSel = (IStructuredSelection) sel; for (Object obj : sSel.toList()) { if (obj instanceof IServiceJob) { IServiceJob serviceJob = (IServiceJob) obj; if (serviceJob.needsSubmissionWizard()) { JobSubmissionServiceWizard serviceWizard = new JobSubmissionServiceWizard( serviceJob.getParent().getProject().getVO()); WizardDialog dialog = new WizardDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), serviceWizard); if (dialog.open() == WizardDialog.OK) { serviceJob.setSubmissionService(serviceWizard.getSelectedService()); serviceJob.run(); } } else { serviceJob.run(); } } } } } super.run(); } }; this.runJobAction.setImageDescriptor(runDesc); this.runJobAction.setDisabledImageDescriptor(runDisabledDesc); this.runJobAction.setEnabled(!getSelection().isEmpty()); this.runJobAction.setToolTipText(Messages.getString("ServiceJobsView.run_button_tooltip")); mgr.add(this.runJobAction); mgr.add(this.wizardAction); refreshViewer(); }
From source file:eu.geclipse.terminal.internal.NewTerminalDropDownAction.java
License:Open Source License
@Override public void run() { URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newconn_wiz.gif"); //$NON-NLS-1$ Wizard wizard = new Wizard() { @Override// ww w. j a va2s. com public boolean performFinish() { return false; } @Override public void addPages() { ExtPointWizardSelectionListPage page = new ExtPointWizardSelectionListPage( Messages.getString("NewTerminalDropDownAction.selectConnectionType"), //$NON-NLS-1$ EXT_ID_NEW_TERMINAL_WIZARD, Messages.getString("NewTerminalDropDownAction.title"), //$NON-NLS-1$ Messages.getString("NewTerminalDropDownAction.description"), //$NON-NLS-1$ Messages.getString("NewTerminalDropDownAction.noConnectionTypes")); //$NON-NLS-1$ page.setInitData(NewTerminalDropDownAction.this.terminalView); addPage(page); } }; wizard.setForcePreviousAndNextButtons(true); wizard.setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl)); wizard.setWindowTitle(Messages.getString("NewTerminalDropDownAction.newTerminalSession")); //$NON-NLS-1$ WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); wizardDialog.open(); }
From source file:eu.geclipse.terminal.ssh.internal.SSHWizard.java
License:Open Source License
public boolean init(final Object data) { boolean result = false; if (data instanceof ITerminalView) { this.termView = (ITerminalView) data; URL imgUrl = Activator.getDefault().getBundle().getEntry("icons/wizban/newconn_wiz.gif"); //$NON-NLS-1$ setDefaultPageImageDescriptor(ImageDescriptor.createFromURL(imgUrl)); result = true;/* w w w. j ava2 s . c o m*/ } return result; }