public ToggleSubjobsRetargetAction() { super(ToggleSubjobsAction.ID, ToggleSubjobsAction.TEXT, IAction.AS_CHECK_BOX); setToolTipText(ToggleSubjobsAction.TEXT); ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); // TODO Provides appropriate hover and disabled images setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.TOGGLE_SUBJOB)); setDisabledImageDescriptor(ImageProvider.getImageDesc(ECoreImage.TOGGLE_SUBJOB_DISABLED)); }
/** * Sets the isCompactView. * * @param isCompactView the isCompactView to set */ public void setCompactView(boolean isCompactView) { this.isCompactView = isCompactView; if (displayCompactToolbar) { if (isCompactView) { getCompactButton().setImage(ImageProvider.getImage(EImage.COMPACT_VIEW)); getTableButton().setImage(ImageProvider.getImage(EImage.NO_TABLE_VIEW)); } else { getCompactButton().setImage(ImageProvider.getImage(EImage.NO_COMPACT_VIEW)); getTableButton().setImage(ImageProvider.getImage(EImage.TABLE_VIEW)); } } }
@Override public Image getImage(Object element) { if (isRecycleBin(element)) { RepositoryNode recyclebinNode = (RepositoryNode) element; if (recyclebinNode.getChildren().isEmpty()) { return ImageProvider.getImage(ECoreImage.RECYCLE_BIN_EMPTY_ICON); } else { return ImageProvider.getImage(ECoreImage.RECYCLE_BIN_FULL_ICON); } } return null; // if others, ignore }
/* * (non-Javadoc) * * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) */ public Image getImage(Object objects) { Node node = null; if (objects == null || objects.equals(StructuredSelection.EMPTY)) { return null; } if (!(objects instanceof IStructuredSelection)) { return null; } final boolean[] multiple = {false}; Object object = getObject(objects, multiple); if (object == null) { return null; } if ((object instanceof NodeTreeEditPart)) { node = (Node) ((NodeTreeEditPart) object).getModel(); } else { if (object instanceof NodeReturnsTreeEditPart) { node = lastNode; } else { if (object instanceof ProcessPart) { return ImageProvider.getImage(ECoreImage.PROCESS_ICON); } if (object instanceof ConnectionPart) { return ImageProvider.getImage(EImage.RIGHT_ICON); } if (object instanceof NoteEditPart) { return ImageProvider.getImage(ECoreImage.CODE_ICON); } if (object instanceof ConnLabelEditPart) { return ImageProvider.getImage(EImage.RIGHT_ICON); } if ((object instanceof NodeLabelEditPart)) { node = ((NodeContainer) ((NodeLabelEditPart) object).getParent().getModel()).getNode(); } if (!(object instanceof NodePart)) { return null; } if (node == null) { node = (Node) ((NodePart) object).getModel(); } } } if (lastNode != node) { lastNode = node; } return CoreImageProvider.getComponentIcon(node.getComponent(), ICON_SIZE.ICON_24); }
public EditRoutineAction() { super(); setText(Messages.getString("EditRoutineAction.text.editRoutine")); // $NON-NLS-1$ setToolTipText(Messages.getString("EditRoutineAction.toolTipText.editRoutine")); // $NON-NLS-1$ setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.ROUTINE_ICON)); }
private Button createAddPushButton(final Composite parent) { Button addPushButton = new Button(parent, SWT.PUSH); addPushButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IContextParameter parameter = (IContextParameter) createNewEntry(); if (parameter != null) { // set the source to built-in parameter.setSource(IContextParameter.BUILT_IN); modelManager.onContextAddParameter(getContextManager(), parameter); // see feature 4661: Add an option to propagate when add or remove a variable in a // repository // context to jobs/joblets. if (ContextUtils.isPropagateContextVariable() && getContextManager() != null) { IContextManager manager = getContextManager(); if (manager != null && manager instanceof JobContextManager) { JobContextManager jobManger = (JobContextManager) manager; // set updated flag. jobManger.setModified(true); jobManger.addNewParameters(parameter.getName()); } } } } }); Image image = ImageProvider.getImage(EImage.ADD_ICON); addPushButton.setImage(image); return addPushButton; }
public OpenExistVersionProcessAction() { super(); this.setText(ACTION_LABEL); this.setToolTipText(ACTION_LABEL); this.setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.PROCESS_ICON)); }
/** Constructs a new OpenDocumentationAction. */ public OpenDocumentationAction() { super(); setText(Messages.getString("OpenDocumentationAction.openDocAction.openDoc")); // $NON-NLS-1$ setToolTipText( Messages.getString("OpenDocumentationAction.openDocAcitonTipText.openDoc")); // $NON-NLS-1$ setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.DOCUMENTATION_ICON)); }
public CreateFolderAction() { super(); this.setText(Messages.getString("CreateFolderAction.action.title")); // $NON-NLS-1$ this.setToolTipText(Messages.getString("CreateFolderAction.action.toolTipText")); // $NON-NLS-1$ Image folderImg = ImageProvider.getImage(ECoreImage.FOLDER_CLOSE_ICON); this.setImageDescriptor(OverlayImageProvider.getImageWithNew(folderImg)); }
/** * DOC xqliu Comment method "initDialog". * * @param object * @param cancelFlag * @param message */ private void initDialog(Object object, boolean cancelFlag, String message) { this.source = object; this.canCancel = cancelFlag; setDefaultImage(ImageProvider.getImage(ECoreImage.CONTEXT_ICON)); setHelpAvailable(false); setTitle(TITLE); setMessage(message); }
/** Constructs a new ExtractDocumentationAction. */ public ExtractDocumentationAction() { super(); setText(Messages.getString("ExtractDocumentationAction.text.saveAs")); // $NON-NLS-1$ setToolTipText( Messages.getString( "ExtractDocumentationAction.toolTipText.extractDoctoFileSys")); //$NON-NLS-1$ setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.DOCUMENTATION_ICON)); }
/* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) */ public Image getImage(Object element) { Image i = null; if (element instanceof SQLEditorAllProposal) { i = ((SQLEditorAllProposal) element).getImage(); if (i != null) { return i; } } return ImageProvider.getImage(sqlEditor); }
/* * (non-Javadoc) * * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) */ public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 0) { if (element instanceof IContainerEntry) { return ((IContainerEntry) element).getImage(); } } else if (columnIndex == 1) { if (element instanceof Problem) { return ImageProvider.getImage(EImage.ERROR_SMALL); } } return null; }
protected void paintGrid( Graphics g, IFigure f, org.eclipse.draw2d.geometry.Point origin, int distanceX, int distanceY) { FreeformFigure ff = (FreeformFigure) this.getParent(); Rectangle clientArea = getClientArea(); Rectangle bounds = ff.getFreeformExtent().getCopy(); bounds.union(clientArea.x, clientArea.y, clientArea.width, clientArea.height); ff.setFreeformBounds(bounds); Rectangle original = g.getClip(Rectangle.SINGLETON); Rectangle clip = new Rectangle( original.x - original.x % distanceX, original.y - original.y % distanceY, original.width + Math.abs(original.x % distanceX), original.height + Math.abs(original.y % distanceY)); if (distanceX > 0 && distanceY > 0) { if (origin.x >= clip.x) { while (origin.x - distanceX >= clip.x) { origin.x -= distanceX; } } else { while (origin.x < clip.x) { origin.x += distanceX; } } if (origin.y >= clip.y) { while (origin.y - distanceY >= clip.y) { origin.y -= distanceY; } } else { while (origin.y < clip.y) { origin.y += distanceY; } } for (int i = origin.x; i < clip.x + clip.width; i += distanceX) { for (int j = origin.y; j < clip.y + clip.height; j += distanceY) { // g.drawPoint(i, j); int re = Math.abs(i - j); if (re / distanceY % 2 == 0) { g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY), i, j); } } } } }
private Button createSelectContextVariablesPushButton(final Composite parent) { Button selectContextVariablesPushButton = new Button(parent, SWT.PUSH); Image image = ImageProvider.getImage(ECoreImage.CONTEXT_ICON); selectContextVariablesPushButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { SelectRepositoryContextDialog dialog = new SelectRepositoryContextDialog( getContextModelManager(), parent.getShell(), helper); if (dialog.open() == Dialog.OK) { // ADD msjian TDQ-9629: if the current perspective is dataprofiling, change all to // builtin context IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (activePage != null) { if ("org.talend.dataprofiler.DataProfilingPerspective" .equals(activePage.getPerspective().getId())) { // $NON-NLS-1$ IContextManager contextManager = getContextModelManager().getContextManager(); if (contextManager instanceof JobContextManager) { JobContextManager jobContextManager = (JobContextManager) contextManager; jobContextManager.setModified(true); } List<IContext> listContext = contextManager.getListContext(); if (listContext != null) { for (IContext context : listContext) { List<IContextParameter> contextParameterList = context.getContextParameterList(); if (contextParameterList != null) { for (IContextParameter contextParameter : contextParameterList) { contextParameter.setSource(IContextParameter.BUILT_IN); } } } } contextManager.fireContextsChangedEvent(); } } // TDQ-9629~ refresh(); } } }); selectContextVariablesPushButton.setImage(image); return selectContextVariablesPushButton; }
private Button createRemovePushButton(final Composite parent) { Button removePushButton = new Button(parent, SWT.PUSH); removePushButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection sel = treeTable.getSelection(); if (treeTable.getSelection() != null) { Object[] obj = new Object[sel.toList().size()]; int i = 0; for (Object node : sel.toList().toArray()) { if (node instanceof ContextTreeNode) { obj[i++] = ((ContextTreeNode) node).getTreeData(); } } for (Object object : obj) { // multi delete if (object == null) { return; } if (object instanceof ContextTableTabParentModel) { ContextTableTabParentModel parentModel = (ContextTableTabParentModel) object; removeParentModelInGroupBySource(parentModel); } else if (object instanceof ContextTableTabChildModel) { ContextTableTabChildModel childModel = (ContextTableTabChildModel) object; removeChildModelInGroupBySource(childModel); } } modelManager.refresh(); setButtonEnableState(); if (!treeTable.getSelection().isEmpty()) { treeTable.clearSelection(); } } } }); Image image = ImageProvider.getImage(EImage.DELETE_ICON); removePushButton.setImage(image); return removePushButton; }
private Button createMoveDownPushButton(final Composite parent) { Button moveDownPushButton = new Button(parent, SWT.PUSH); Image image = ImageProvider.getImage(EImage.DOWN_ICON); moveDownPushButton.setImage(image); moveDownPushButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection sel = treeTable.getSelection(); if (ContextManagerHelper.changeContextOrder(sel, modelManager, false)) { setButtonEnableState(); } } }); return moveDownPushButton; }
/* (non-Javadoc) * @see org.eclipse.jface.wizard.Wizard#addPages() */ public void addPages() { setWindowTitle(Messages.getString("SapTableWizard.WindowTitle")); setDefaultPageImageDescriptor(ImageProvider.getImageDesc(ECoreImage.METADATA_TABLE_WIZ)); this.propertiesWizardPage = new Step0WizardPage( connectionProperty, pathToSave, ERepositoryObjectType.METADATA_MDMCONNECTION, true, creation); this.sapTablePage = new SapTableWizardPage( this.connectionItem, functionUnit, this.metadataTable, isRepositoryObjectEditable()); if (creation) { propertiesWizardPage.setTitle( Messages.getString("SapTableWizardPage.TitleCreate.Step1")); // $NON-NLS-1$ propertiesWizardPage.setDescription( Messages.getString("SapTableWizardPage.DescriptionCreate.Step1")); // $NON-NLS-1$ propertiesWizardPage.setPageComplete(false); sapTablePage.setTitle( Messages.getString("SapTableWizardPage.TitleCreate.Step2")); // $NON-NLS-1$ sapTablePage.setDescription( Messages.getString("SapTableWizardPage.DescriptionCreate.Step2")); // $NON-NLS-1$ sapTablePage.setPageComplete(false); } else { propertiesWizardPage.setTitle( Messages.getString("SapTableWizardPage.TitleUpdate.Step1")); // $NON-NLS-1$ propertiesWizardPage.setDescription( Messages.getString("SapTableWizardPage.DescriptionUpdate.Step1")); // $NON-NLS-1$ propertiesWizardPage.setPageComplete(isRepositoryObjectEditable()); sapTablePage.setTitle( Messages.getString("SapTableWizardPage.TitleUpdate.Step2")); // $NON-NLS-1$ sapTablePage.setDescription( Messages.getString("SapTableWizardPage.DescriptionUpdate.Step2")); // $NON-NLS-1$ sapTablePage.setPageComplete(isRepositoryObjectEditable()); } addPage(this.propertiesWizardPage); addPage(this.sapTablePage); }
private void createNatTable() { ContextTreeTable.TControl tControl = treeTable.createTable(contextTableComp); GridDataFactory.fillDefaults().grab(true, true).applyTo(tControl.getControl()); configContext = new ConfigureContextAction(modelManager, this.getShell()); contextConfigButton = new Button(contextTableComp, SWT.NULL); GridData addContextGridData = new GridData(); addContextGridData.verticalAlignment = SWT.TOP; contextConfigButton.setLayoutData(addContextGridData); contextConfigButton.setImage(ImageProvider.getImage(EImage.ADD_ICON)); contextConfigButton.setToolTipText(configContext.getText()); contextConfigButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { configContext.run(); } }); }
private void configureAutoIndexColumn( TableViewerCreator<IMetadataColumn> tableViewerCreator, Table table) { TableViewerCreatorColumn<IMetadataColumn, Boolean> column = new TableViewerCreatorColumn<IMetadataColumn, Boolean>(tableViewerCreator); column.setBeanPropertyAccessors( new IBeanPropertyAccessors<IMetadataColumn, Boolean>() { @Override public Boolean get(IMetadataColumn bean) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; return columnExt.getData().isAutoIndexed(); } return false; } @Override public void set(IMetadataColumn bean, Boolean value) { if (bean instanceof MetadataColumnExt) { MetadataColumnExt columnExt = (MetadataColumnExt) bean; columnExt.getData().setAutoIndexed(value); } } }); String title = "Auto indexed"; // TODO: Internationalize this column.setTitle(title); column.setToolTipHeader(title); column.setModifiable(true); column.setWidth(76); column.setDisplayedValue(""); column.setTableColumnSelectionListener( new CheckColumnSelectionListener(column, tableViewerCreator)); column.setImageHeader(ImageProvider.getImage(EImage.CHECKED_ICON)); CheckboxTableEditorContent checkbox = new CheckboxTableEditorContent(); checkbox.setToolTipText(title); column.setTableEditorContent(checkbox); }
public CreateHCatalogSchemaAction() { super(); setText(CREATE_LABEL); setToolTipText(CREATE_LABEL); setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.METADATA_TABLE_ICON)); }
// TODO the implementation of this method is horrible and creating too many widgets // table/column renderer/editor should be used instead should be used instead protected void addInstallButtons() { final AtomicInteger enabledButtonCount = new AtomicInteger(0); tableViewerCreator.getTableViewer().getControl().setRedraw(false); final Table table = tableViewerCreator.getTable(); manualInstallButtonMap = new HashMap<ModuleToInstall, Button>(); ILibrariesService librariesService = LibManagerUiPlugin.getDefault().getLibrariesService(); disposePreviousEditors(); for (final TableItem item : table.getItems()) { TableEditor editor = new TableEditor(table); installButtonsEditors.add(editor); Control control = null; Object obj = item.getData(); if (obj instanceof ModuleToInstall) { final ModuleToInstall data = (ModuleToInstall) obj; boolean isInstalled = false; try { isInstalled = librariesService.getLibraryStatus(data.getName()) == ELibraryInstallStatus.INSTALLED; } catch (BusinessException e1) { // log the error and consider as unsinstalled log.error(e1); } boolean hasDownloadUrl = data.getUrl_description() != null; if (!MavenConstants.DOWNLOAD_MANUAL.equals( data.getDistribution())) { // add the button to download final Button button = new Button(table, SWT.FLAT); control = button; enabledButtonCount.incrementAndGet(); button.setText( Messages.getString("ExternalModulesInstallDialog_Download")); // $NON-NLS-1$ button.setData(item); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { table.select(table.indexOf(item)); launchIndividualDownload(enabledButtonCount, data, button); } }); button.setEnabled(!isInstalled); button.setToolTipText(data.toString()); } else { // add the link for manual download Composite composite = new Composite(table, SWT.NONE); composite.setBackground(color); control = composite; GridLayout layout = new GridLayout(hasDownloadUrl ? 2 : 1, false); layout.marginHeight = 0; layout.verticalSpacing = 1; composite.setLayout(layout); if (hasDownloadUrl) { Link openLink = new Link(composite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(openLink); openLink.setBackground(color); // openLink.setLayoutData(gData); openLink.setText( "<a href=\"\">" + Messages.getString("ExternalModulesInstallDialog.openInBrowser") + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ openLink.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { // Program.launch(data.getUrl_description()); openURL(data.getUrl_description()); } }); } // else no download URL so just add the install buttonb enabledButtonCount.incrementAndGet(); Button importButton = new Button(composite, SWT.FLAT); importButton.setImage(ImageProvider.getImage(ECoreImage.IMPORT_JAR)); importButton.setToolTipText( Messages.getString("ImportExternalJarAction.title")); // $NON-NLS-1$ importButton.addSelectionListener( new ImportButtonSelectionListener(enabledButtonCount, item)); manualInstallButtonMap.put(data, importButton); GridDataFactory.fillDefaults() .align(SWT.RIGHT, SWT.CENTER) .grab(true, false) .applyTo(importButton); importButton.setEnabled(!isInstalled); importButton.setToolTipText(data.toString()); } editor.grabHorizontal = true; editor.setEditor(control, item, tableViewerCreator.getColumns().indexOf(installcolumn)); editor.layout(); // url editor = new TableEditor(table); installButtonsEditors.add(editor); Composite composite = new Composite(table, SWT.NONE); composite.setBackground(color); // GridLayout layout = new GridLayout(); FormLayout layout = new FormLayout(); layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); FormData gData = new FormData(); gData.left = new FormAttachment(0); gData.right = new FormAttachment(100); gData.top = new FormAttachment(composite, 0, SWT.CENTER); final Link openLink = new Link(composite, SWT.NONE); openLink.setLayoutData(gData); openLink.setBackground(color); gData.height = new GC(composite).stringExtent(" ").y; // $NON-NLS-1$ openLink.setText( "<a href=\"\">" + (hasDownloadUrl ? data.getUrl_description() : "") + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ openLink.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { // Program.launch(data.getUrl_description()); openURL(data.getUrl_description()); } }); editor.grabHorizontal = true; // editor.minimumHeight = 20; editor.setEditor(composite, item, tableViewerCreator.getColumns().indexOf(urlcolumn)); editor.layout(); } } tableViewerCreator.getTableViewer().getTable().layout(); tableViewerCreator.getTableViewer().refresh(true); tableViewerCreator.getTableViewer().getControl().setRedraw(true); }
@Override protected Control createDialogArea(Composite parent) { // set the whole page white parent.setBackground(new Color(null, new RGB(255, 255, 255))); parent.setBackgroundMode(SWT.INHERIT_FORCE); Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout); Composite top = new Composite(container, SWT.NONE); top.setLayout(new GridLayout()); top.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); Label label = new Label(top, SWT.NONE); label.setText(REGISTER_TITLE); label.setFont(TITLE_FONT); label.setForeground(YELLOW_GREEN_COLOR); Composite centerComposite = new Composite(container, SWT.NONE); centerComposite.setLayout(new GridLayout()); // top.setLayoutData(new // GridData(GridData.HORIZONTAL_ALIGN_CENTER)); centerComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); // createSpacer(centerComposite, SWT.NONE); IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class); String thanks1 = Messages.getString("RegisterWizardPage.legalthanks1", brandingService.getCorporationName()); String thanks2 = Messages.getString("RegisterWizardPage.legalthanks2", brandingService.getCorporationName()); Font font2 = new Font(null, "Arial", 10, SWT.BOLD); Composite c1 = new Composite(centerComposite, SWT.NONE); c1.setLayout(new GridLayout()); c1.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); Label label1 = new Label(c1, SWT.NONE); label1.setText(thanks1); label1.setFont(font2); Composite c2 = new Composite(centerComposite, SWT.NONE); c2.setLayout(new GridLayout()); c2.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); Label label2 = new Label(c2, SWT.NONE); label2.setText(thanks2); label2.setFont(font2); // createSpacer(centerComposite, SWT.NONE); createSpacer(centerComposite, SWT.NONE); String string = Messages.getString("RegisterWizardPage.legalconfirm", brandingService.getCorporationName()); Composite c3 = new Composite(centerComposite, SWT.NONE); c3.setLayout(new GridLayout()); c3.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); Label label3 = new Label(c3, SWT.NONE); label3.setText(string); // label3.setFont(font2); // createLegalInfos(centerComposite, 1, string2); createSpacer(centerComposite, SWT.NONE); Composite bottomComposite = new Composite(container, SWT.NONE); bottomComposite.setLayout(new GridLayout(3, true)); bottomComposite.setLayoutData(new GridData()); new Label(bottomComposite, SWT.NONE); // label3.setLayoutData(new GridData()); new ImageCanvas(bottomComposite, ImageProvider.getImageDesc(ERepositoryImages.REGISTER_ICO)); return container; }
public SalesforceSchemaWizard( IWorkbench workbench, boolean creation, RepositoryNode node, String[] existingNames, boolean isSinglePageOnly) { super(workbench, creation); this.existingNames = existingNames; this.isSinglePageOnly = isSinglePageOnly; setNeedsProgressMonitor(true); // TODO: should to changed icon. setDefaultPageImageDescriptor(ImageProvider.getImageDesc(ECoreImage.DEFAULT_WIZ)); switch (node.getType()) { case SIMPLE_FOLDER: case REPOSITORY_ELEMENT: pathToSave = RepositoryNodeUtilities.getPath(node); break; case SYSTEM_FOLDER: pathToSave = new Path(""); // $NON-NLS-1$ break; } switch (node.getType()) { case SIMPLE_FOLDER: case SYSTEM_FOLDER: connection = ConnectionFactory.eINSTANCE.createSalesforceSchemaConnection(); connection.setName(ERepositoryObjectType.METADATA_SALESFORCE_SCHEMA.getKey()); MetadataTable metadataTable = ConnectionFactory.eINSTANCE.createMetadataTable(); IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance(); metadataTable.setId(factory.getNextId()); RecordFile record = (RecordFile) ConnectionHelper.getPackage(connection.getName(), connection, RecordFile.class); if (record != null) { // hywang PackageHelper.addMetadataTable(metadataTable, record); } else { RecordFile newrecord = RecordFactory.eINSTANCE.createRecordFile(); newrecord.setName(connection.getName()); ConnectionHelper.addPackage(newrecord, connection); PackageHelper.addMetadataTable(metadataTable, newrecord); } connectionProperty = PropertiesFactory.eINSTANCE.createProperty(); connectionProperty.setAuthor( ((RepositoryContext) CoreRuntimePlugin.getInstance() .getContext() .getProperty(Context.REPOSITORY_CONTEXT_KEY)) .getUser()); connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION); connectionProperty.setStatusCode(""); // $NON-NLS-1$ connectionItem = PropertiesFactory.eINSTANCE.createSalesforceSchemaConnectionItem(); connectionItem.setProperty(connectionProperty); connectionItem.setConnection(connection); initProxySettings(connection); break; case REPOSITORY_ELEMENT: connection = (SalesforceSchemaConnection) ((ConnectionItem) node.getObject().getProperty().getItem()).getConnection(); connectionProperty = node.getObject().getProperty(); connectionItem = (ConnectionItem) node.getObject().getProperty().getItem(); // set the repositoryObject, lock and set isRepositoryObjectEditable setRepositoryObject(node.getObject()); isRepositoryObjectEditable(); initLockStrategy(); break; } if (!creation) { this.originaleObjectLabel = this.connectionItem.getProperty().getLabel(); this.originalVersion = this.connectionItem.getProperty().getVersion(); this.originalDescription = this.connectionItem.getProperty().getDescription(); this.originalPurpose = this.connectionItem.getProperty().getPurpose(); this.originalStatus = this.connectionItem.getProperty().getStatusCode(); } initConnection(); }
/** * DOC talend MoveUpTreeNodeButton constructor comment. * * @param parent * @param extendedViewer * @param tooltip * @param image */ public MoveUpTreeNodeButton(Composite parent, FOXManager manager) { super(parent, manager, "Move up", ImageProvider.getImage(EImage.UP_ICON)); }
/** * DOC smallet ConnectionsComposite constructor comment. * * @param parent * @param style */ public ConnectionFormComposite( Composite parent, int style, ConnectionsListComposite connectionsListComposite, ConnectionsDialog dialog) { super(parent, style); this.dialog = dialog; this.connectionsListComposite = connectionsListComposite; toolkit = new FormToolkit(this.getDisplay()); toolkit.setBackground(ColorConstants.white); Composite formBody = toolkit.createComposite(this); formBody.setBackground(ColorConstants.white); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; setLayout(layout); formBody.setLayoutData(new GridData(GridData.FILL_BOTH)); formBody.setLayout(new GridLayout(3, false)); GridDataFactory formDefaultFactory = GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER); // Repository Label repositoryLabel = toolkit.createLabel( formBody, Messages.getString("connections.form.field.repository")); // $NON-NLS-1$ formDefaultFactory.copy().applyTo(repositoryLabel); repositoryCombo = new ComboViewer(formBody, SWT.BORDER | SWT.READ_ONLY); repositoryCombo.setContentProvider(ArrayContentProvider.getInstance()); repositoryCombo.setLabelProvider(new RepositoryFactoryLabelProvider()); formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(repositoryCombo.getControl()); // Name Label nameLabel = toolkit.createLabel( formBody, Messages.getString("connections.form.field.name")); // $NON-NLS-1$ formDefaultFactory.copy().applyTo(nameLabel); nameText = toolkit.createText(formBody, "", SWT.BORDER); // $NON-NLS-1$ formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(nameText); // Comment Label descriptionLabel = toolkit.createLabel( formBody, Messages.getString("connections.form.field.description")); // $NON-NLS-1$ formDefaultFactory.copy().applyTo(descriptionLabel); descriptionText = toolkit.createText(formBody, "", SWT.BORDER); // $NON-NLS-1$ formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(descriptionText); // User IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class); boolean usesMailCheck = brandingService.getBrandingConfiguration().isUseMailLoginCheck(); Label userLabel; if (usesMailCheck) { userLabel = toolkit.createLabel( formBody, Messages.getString("connections.form.field.username")); // $NON-NLS-1$ } else { userLabel = toolkit.createLabel( formBody, Messages.getString("connections.form.field.usernameNoMail")); // $NON-NLS-1$ } formDefaultFactory.copy().applyTo(userLabel); userText = toolkit.createText(formBody, "", SWT.BORDER); // $NON-NLS-1$ formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(userText); // Password passwordLabel = toolkit.createLabel( formBody, Messages.getString("connections.form.field.password")); // $NON-NLS-1$ formDefaultFactory.copy().applyTo(passwordLabel); passwordText = toolkit.createText(formBody, "", SWT.PASSWORD | SWT.BORDER); // $NON-NLS-1$ formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(passwordText); Label workSpaceLabel = toolkit.createLabel( formBody, Messages.getString("ConnectionFormComposite.WORKSPACE")); // $NON-NLS-1$ formDefaultFactory.copy().applyTo(workSpaceLabel); Composite wsCompo = toolkit.createComposite(formBody); GridLayout wsCompoLayout = new GridLayout(2, false); wsCompoLayout.marginHeight = 0; wsCompoLayout.marginWidth = 0; wsCompo.setLayout(wsCompoLayout); formDefaultFactory.copy().grab(true, false).span(2, 1).applyTo(wsCompo); workSpaceText = toolkit.createText(wsCompo, "", SWT.BORDER); // $NON-NLS-1$ formDefaultFactory.copy().grab(true, false).applyTo(workSpaceText); workSpaceButton = toolkit.createButton(wsCompo, null, SWT.PUSH); workSpaceButton.setToolTipText( Messages.getString("ConnectionFormComposite.SELECT_WORKSPACE")); // $NON-NLS-1$ workSpaceButton.setImage(ImageProvider.getImage(EImage.THREE_DOTS_ICON)); GridDataFactory.fillDefaults().applyTo(workSpaceButton); List<IRepositoryFactory> availableRepositories = getUsableRepositoryProvider(); for (IRepositoryFactory current : availableRepositories) { Map<String, LabelText> list = new HashMap<String, LabelText>(); Map<String, LabelText> listRequired = new HashMap<String, LabelText>(); Map<String, Button> listButtons = new HashMap<String, Button>(); Map<String, LabelledCombo> listChoices = new HashMap<String, LabelledCombo>(); dynamicControls.put(current, list); dynamicRequiredControls.put(current, listRequired); dynamicButtons.put(current, listButtons); dynamicChoices.put(current, listChoices); for (final DynamicChoiceBean currentChoiceBean : current.getChoices()) { Label label = toolkit.createLabel(formBody, currentChoiceBean.getName()); formDefaultFactory.copy().applyTo(label); Combo combo = new Combo(formBody, SWT.BORDER | SWT.READ_ONLY); for (String label1 : currentChoiceBean.getChoices().values()) { combo.add(label1); } formDefaultFactory.copy().grab(true, false).applyTo(combo); listChoices.put(currentChoiceBean.getId(), new LabelledCombo(label, combo)); } for (DynamicFieldBean currentField : current.getFields()) { int textStyle = SWT.BORDER; if (currentField.isPassword()) { textStyle = textStyle | SWT.PASSWORD; } Label label = toolkit.createLabel(formBody, currentField.getName()); formDefaultFactory.copy().align(SWT.FILL, SWT.CENTER).applyTo(label); Text text = toolkit.createText(formBody, "", textStyle); // $NON-NLS-1$ formDefaultFactory.copy().grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(text); LabelText labelText = new LabelText(label, text); if (currentField.isRequired()) { listRequired.put(currentField.getId(), labelText); } list.put(currentField.getId(), labelText); } for (final DynamicButtonBean currentButtonBean : current.getButtons()) { Button button = new Button(formBody, SWT.PUSH); button.setText(currentButtonBean.getName()); button.addSelectionListener(new DelegateSelectionListener(currentButtonBean)); formDefaultFactory.copy().align(SWT.RIGHT, SWT.CENTER).applyTo(button); listButtons.put(currentButtonBean.getId(), button); } } Label seperator = new Label(formBody, SWT.NONE); seperator.setVisible(false); GridData seperatorGridData = new GridData(); seperatorGridData.horizontalSpan = 3; seperatorGridData.heightHint = 0; seperator.setLayoutData(seperatorGridData); Label placeHolder = new Label(formBody, SWT.NONE); // add delete buttons deleteProjectsButton = new Button(formBody, SWT.NONE); deleteProjectsButton.setText( Messages.getString("ConnectionFormComposite.deleteExistingProject")); // $NON-NLS-1$ GridData deleteButtonGridData = new GridData(); deleteButtonGridData.widthHint = LoginDialogV2.getNewButtonSize(deleteProjectsButton).x; deleteButtonGridData.horizontalSpan = 2; deleteProjectsButton.setLayoutData(deleteButtonGridData); addListeners(); addWorkSpaceListener(); fillLists(); showHideDynamicsControls(); showHideTexts(); // validateFields(); }
public GenerateJobTriggerAction() { super(Messages.GenerateJobXX_GenTJobTrigger); setImageDescriptor(ImageProvider.getImageDesc(ECoreImage.PROCESS_ICON)); }
public EditJSONPropertiesAction() { super(); this.setText(Messages.EditJSONPropertiesAction_EDIT_PROPERTIES); this.setToolTipText(Messages.EditJSONPropertiesAction_EDIT_PROPERTIES); this.setImageDescriptor(ImageProvider.getImageDesc(EImage.EDIT_ICON)); }
/* * (non-Javadoc) * * @see * org.talend.designer.core.ui.editor.properties2.editors.AbstractElementPropertySectionController#createControl() */ @Override public Control createControl( final Composite subComposite, final IElementParameter param, final int numInRow, final int nbInRow, final int top, final Control lastControl) { this.curParameter = param; FormData data; Button btnEdit = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); // $NON-NLS-1$ btnEdit.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON))); data = new FormData(); data.left = new FormAttachment(0, 120); data.top = new FormAttachment(0, top); data.height = STANDARD_HEIGHT - 2; btnEdit.setLayoutData(data); btnEdit.setData(NAME, ICON_SELECTION); btnEdit.setData(PARAMETER_NAME, param.getName()); btnEdit.setEnabled(!param.isReadOnly()); btnEdit.addSelectionListener(listenerSelection); DecoratedField dField = new DecoratedField( subComposite, SWT.NONE, new IControlCreator() { @Override public Control createControl(Composite parent, int style) { return new Label(parent, style); } }); // revert btn Button btnRevert = getWidgetFactory() .createButton( subComposite, Messages.getString("IconSelectionController.Revert"), SWT.PUSH); //$NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(btnEdit, 5); data.top = new FormAttachment(0, top); data.height = STANDARD_HEIGHT - 2; btnRevert.setLayoutData(data); btnRevert.setData(NAME, ICON_REVERT); btnRevert.setData(PARAMETER_NAME, param.getName()); btnRevert.setEnabled(!param.isReadOnly()); btnRevert.addSelectionListener(listenerSelection); if (param.isRequired()) { FieldDecoration decoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_REQUIRED); dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false); } if (param.isRepositoryValueUsed()) { FieldDecoration decoration = FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL); decoration.setDescription( Messages.getString("FileController.decoration.description")); // $NON-NLS-1$ dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.BOTTOM, false); } Control cLayout = dField.getLayoutControl(); filePathText = (Label) dField.getControl(); String file = (String) elem.getPropertyValue(PARAMETER_NAME); if (file != null) { // ImageData imageData = new ImageData(file); // image = new Image(composite.getShell().getDisplay(), imageData); // filePathText.setImage(image); } CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName(), 0); data = new FormData(); if (lastControl != null) { data.left = new FormAttachment(lastControl, 0); } else { data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0); } data.top = new FormAttachment(0, top); labelLabel.setLayoutData(data); if (numInRow != 1) { labelLabel.setAlignment(SWT.RIGHT); } // ************************** data = new FormData(); int currentLabelWidth = 50; GC gc = new GC(labelLabel); Point labelSize = gc.stringExtent(param.getDisplayName()); gc.dispose(); if ((labelSize.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth) { currentLabelWidth = labelSize.x + ITabbedPropertyConstants.HSPACE; } if (numInRow == 1) { if (lastControl != null) { data.left = new FormAttachment(lastControl, currentLabelWidth); } else { data.left = new FormAttachment(0, currentLabelWidth); } } else { data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT); } data.top = new FormAttachment(btnEdit, 0, SWT.CENTER); data.height = 34; data.width = 30; cLayout.setLayoutData(data); Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); dynamicProperty.setCurRowSize(initialSize.y + ITabbedPropertyConstants.VSPACE); return btnEdit; }
public CreatePigudfAction() { setText(Messages.getString("CreatePigudfAction.actionName")); // $NON-NLS-1$ Image folderImg = ImageProvider.getImage(ECoreImage.ROUTINE_ICON); this.setImageDescriptor(OverlayImageProvider.getImageWithNew(folderImg)); }