Java Code Examples for org.eclipse.swt.custom.CTabItem#setImage()
The following examples show how to use
org.eclipse.swt.custom.CTabItem#setImage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptDialog.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void refresh() { // CTabItem item = getCTabItemByName(strActiveScript); for ( int i = 0; i < folder.getItemCount(); i++ ) { CTabItem item = folder.getItem( i ); if ( item.getText().equals( strActiveScript ) ) { item.setImage( imageActiveScript ); } else if ( item.getText().equals( strActiveStartScript ) ) { item.setImage( imageActiveStartScript ); } else if ( item.getText().equals( strActiveEndScript ) ) { item.setImage( imageActiveEndScript ); } else { item.setImage( imageInactiveScript ); } } // modifyScriptTree(null, SET_ACTIVE_ITEM); }
Example 2
Source File: ScriptDialog.java From hop with Apache License 2.0 | 6 votes |
private void refresh() { // CTabItem item = getCTabItemByName(strActiveScript); for ( int i = 0; i < folder.getItemCount(); i++ ) { CTabItem item = folder.getItem( i ); if ( item.getText().equals( strActiveScript ) ) { item.setImage( imageActiveScript ); } else if ( item.getText().equals( strActiveStartScript ) ) { item.setImage( imageActiveStartScript ); } else if ( item.getText().equals( strActiveEndScript ) ) { item.setImage( imageActiveEndScript ); } else { item.setImage( imageInactiveScript ); } } // modifyScriptTree(null, SET_ACTIVE_ITEM); }
Example 3
Source File: ScriptValuesModDialog.java From hop with Apache License 2.0 | 6 votes |
private void refresh() { // CTabItem item = getCTabItemByName(strActiveScript); for ( int i = 0; i < folder.getItemCount(); i++ ) { CTabItem item = folder.getItem( i ); if ( item.getText().equals( strActiveScript ) ) { item.setImage( imageActiveScript ); } else if ( item.getText().equals( strActiveStartScript ) ) { item.setImage( imageActiveStartScript ); } else if ( item.getText().equals( strActiveEndScript ) ) { item.setImage( imageActiveEndScript ); } else { item.setImage( imageInactiveScript ); } } // modifyScriptTree(null, SET_ACTIVE_ITEM); }
Example 4
Source File: BrowserViewPart.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public void refreshTabContent() { if (browserTabs != null && browserTabs.length != 0) { for (BrowserTab tab : browserTabs) { tab.close(); } } browserTabs = new BrowserTab[urls.size()]; for (int i = 0; i < urls.size(); i++) { SearchEntry searchEntry = urls.get(i); browserTabs[i] = new BrowserTab(searchEntry); CTabItem item = new CTabItem(tabFolder, SWT.NONE); browserTabs[i].setItem(item); item.setText(searchEntry.getSearchName().replaceAll("&", "&&")); item.setControl(browserTabs[i].createTabFolderPage(tabFolder)); item.setData(browserTabs[i]); Image image = getImage(searchEntry.getSearchUrl()); if (null != image) { item.setImage(image); } browserTabs[i].searchKeyWord(keyWordForSearch.getText()); } tabFolder.setSelection(0); tabFolder.layout(); }
Example 5
Source File: GamaPreferencesView.java From gama with GNU General Public License v3.0 | 6 votes |
private void buildContents() { tabFolder = new CTabFolder(shell, SWT.TOP | SWT.NO_TRIM); tabFolder.setBorderVisible(true); tabFolder.setBackgroundMode(SWT.INHERIT_DEFAULT); tabFolder.setMRUVisible(true); tabFolder.setSimple(false); // rounded tabs tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); final Map<String, Map<String, List<Pref>>> prefs = GamaPreferences.organizePrefs(); for (final String tabName : prefs.keySet()) { final CTabItem item = new CTabItem(tabFolder, SWT.NONE); item.setFont(GamaFonts.getNavigHeaderFont()); item.setText(tabName); item.setImage(prefs_images.get(tabName)); item.setShowClose(false); buildContentsFor(item, prefs.get(tabName)); } buildButtons(); shell.layout(); }
Example 6
Source File: UserDefinedJavaClassDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void modifyCTabItem( TreeItem tItem, TabActions iModType, String strOption ) { switch ( iModType ) { case DELETE_ITEM: CTabItem dItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( dItem != null ) { dItem.dispose(); input.setChanged(); } break; case RENAME_ITEM: CTabItem rItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( rItem != null ) { rItem.setText( strOption ); input.setChanged(); if ( rItem.getImage().equals( imageActiveScript ) ) { strActiveScript = strOption; } } break; case SET_ACTIVE_ITEM: CTabItem aItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( aItem != null ) { input.setChanged(); strActiveScript = tItem.getText(); for ( int i = 0; i < folder.getItemCount(); i++ ) { if ( folder.getItem( i ).equals( aItem ) ) { aItem.setImage( imageActiveScript ); } else { folder.getItem( i ).setImage( imageInactiveScript ); } } } break; default: break; } }
Example 7
Source File: HopDataOrchestrationPerspective.java From hop with Apache License 2.0 | 5 votes |
/** * Add a new pipeline tab to the tab folder... * * @param pipelineMeta * @return */ public IHopFileTypeHandler addPipeline( Composite parent, HopGui hopGui, PipelineMeta pipelineMeta, HopPipelineFileType pipelineFile ) throws HopException { CTabItem tabItem = new CTabItem( tabFolder, SWT.CLOSE ); tabItem.setImage( GuiResource.getInstance().getImageToolbarPipeline() ); HopGuiPipelineGraph pipelineGraph = new HopGuiPipelineGraph( tabFolder, hopGui, tabItem, this, pipelineMeta, pipelineFile ); tabItem.setControl( pipelineGraph ); // Set the tab name // updateTabLabel( tabItem, pipelineMeta.getFilename(), pipelineMeta.getName() ); // Switch to the tab tabFolder.setSelection( tabItem ); activeItem = new TabItemHandler( tabItem, pipelineGraph ); items.add( activeItem ); // Remove all the history above the current tabSelectionIndex // while ( tabSelectionHistory.size() - 1 > tabSelectionIndex ) { tabSelectionHistory.pop(); } int tabIndex = tabFolder.indexOf( tabItem ); tabSelectionHistory.add( tabIndex ); tabSelectionIndex = tabSelectionHistory.size() - 1; try { ExtensionPointHandler.callExtensionPoint( hopGui.getLog(), HopExtensionPoint.HopGuiNewPipelineTab.id, pipelineGraph ); } catch ( Exception e ) { throw new HopException( "Error calling extension point plugin for plugin id " + HopExtensionPoint.HopGuiNewPipelineTab.id + " trying to handle a new pipeline tab", e ); } pipelineGraph.setFocus(); return pipelineGraph; }
Example 8
Source File: UserDefinedJavaClassDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void refresh() { for ( int i = 0; i < folder.getItemCount(); i++ ) { CTabItem item = folder.getItem( i ); if ( item.getText().equals( strActiveScript ) ) { item.setImage( imageActiveScript ); } else { item.setImage( imageInactiveScript ); } } }
Example 9
Source File: ComponentTitledFolder.java From arx with Apache License 2.0 | 5 votes |
/** * Sets an entry visible * @return */ private boolean setVisible(String text) { List<TitledFolderEntry> list = getInvisibleEntries(); // Find for (TitledFolderEntry entry : list) { if (entry.text.equals(text)) { // Shift int index = entry.index; for (TitledFolderEntry other : list) { if (other.index < entry.index) { index--; } } // Show CTabItem item = new CTabItem(folder, SWT.NULL, index); item.setText(entry.text); if (entry.image!=null) item.setImage(entry.image); item.setShowClose(false); item.setControl(entry.control); return true; } } return false; }
Example 10
Source File: ComponentTitledFolder.java From arx with Apache License 2.0 | 5 votes |
/** * Creates a new entry in the folder. * * @param title * @param image * @param index * @param hideable * @param layout * @return */ public Composite createItem(String title, Image image, int index, boolean hideable, Layout layout) { Composite composite = new Composite(folder, SWT.NONE); composite.setLayout(layout); CTabItem item = new CTabItem(folder, SWT.NULL, index); item.setText(title); if (image!=null) item.setImage(image); item.setShowClose(false); item.setControl(composite); entries.add(new TitledFolderEntry(title, composite, image, index, hideable)); return composite; }
Example 11
Source File: UserDefinedJavaClassDialog.java From hop with Apache License 2.0 | 5 votes |
private void refresh() { for ( int i = 0; i < folder.getItemCount(); i++ ) { CTabItem item = folder.getItem( i ); if ( item.getText().equals( strActiveScript ) ) { item.setImage( imageActiveScript ); } else { item.setImage( imageInactiveScript ); } } }
Example 12
Source File: UserDefinedJavaClassDialog.java From hop with Apache License 2.0 | 5 votes |
private void modifyCTabItem( TreeItem tItem, TabActions iModType, String strOption ) { switch ( iModType ) { case DELETE_ITEM: CTabItem dItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( dItem != null ) { dItem.dispose(); input.setChanged(); } break; case RENAME_ITEM: CTabItem rItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( rItem != null ) { rItem.setText( strOption ); input.setChanged(); if ( rItem.getImage().equals( imageActiveScript ) ) { strActiveScript = strOption; } } break; case SET_ACTIVE_ITEM: CTabItem aItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( aItem != null ) { input.setChanged(); strActiveScript = tItem.getText(); for ( int i = 0; i < folder.getItemCount(); i++ ) { if ( folder.getItem( i ).equals( aItem ) ) { aItem.setImage( imageActiveScript ); } else { folder.getItem( i ).setImage( imageInactiveScript ); } } } break; default: break; } }
Example 13
Source File: TabFolderReorder.java From hop with Apache License 2.0 | 5 votes |
private void moveTabs( CTabFolder folder, DropTargetEvent event ) { Point point = folder.toControl( folder.getDisplay().getCursorLocation() ); CTabItem item = folder.getItem( new Point( point.x, point.y ) ); if ( item != null && dragItem != null ) { Control dragControl = dragItem.getControl(); String dragText = dragItem.getText(); Image dragImage = dragItem.getImage(); String dragToolTip = dragItem.getToolTipText(); boolean dragShowClose = dragItem.getShowClose(); Object dragData = dragItem.getData(); dragItem.setText( item.getText() ); dragItem.setImage( item.getImage() ); dragItem.setToolTipText( item.getToolTipText() ); dragItem.setData( item.getData() ); dragItem.setShowClose( item.getShowClose() ); dragItem.setControl( item.getControl() ); item.setText( dragText ); item.setImage( dragImage ); item.setToolTipText( dragToolTip ); item.setData( dragData ); item.setShowClose( dragShowClose ); item.setControl( dragControl ); folder.setSelection( item ); } }
Example 14
Source File: HopDataOrchestrationPerspective.java From hop with Apache License 2.0 | 5 votes |
/** * Add a new workflow tab to the tab folder... * * @param workflowMeta * @return The file type handler */ public IHopFileTypeHandler addWorkflow( Composite parent, HopGui hopGui, WorkflowMeta workflowMeta, HopWorkflowFileType workflowFile ) throws HopException { CTabItem tabItem = new CTabItem( tabFolder, SWT.CLOSE ); tabItem.setImage( GuiResource.getInstance().getImageToolbarWorkflow() ); HopGuiWorkflowGraph jobGraph = new HopGuiWorkflowGraph( tabFolder, hopGui, tabItem, this, workflowMeta, workflowFile ); tabItem.setControl( jobGraph ); // Set the tab name // updateTabLabel( tabItem, workflowMeta.getFilename(), workflowMeta.getName() ); // Switch to the tab tabFolder.setSelection( tabItem ); activeItem = new TabItemHandler( tabItem, jobGraph ); items.add( activeItem ); // Remove all the history above the current tabSelectionIndex // while ( tabSelectionHistory.size() - 1 > tabSelectionIndex ) { tabSelectionHistory.pop(); } int tabIndex = tabFolder.indexOf( tabItem ); tabSelectionHistory.add( tabIndex ); tabSelectionIndex = tabSelectionHistory.size() - 1; try { ExtensionPointHandler.callExtensionPoint( hopGui.getLog(), HopExtensionPoint.HopGuiNewJobTab.id, jobGraph ); } catch ( Exception e ) { throw new HopException( "Error calling extension point plugin for plugin id " + HopExtensionPoint.HopGuiNewPipelineTab.id + " trying to handle a new workflow tab", e ); } jobGraph.setFocus(); return jobGraph; }
Example 15
Source File: WizardBaseDialog.java From birt with Eclipse Public License 1.0 | 4 votes |
protected void initializeBounds( ) { // Set shell properties getShell( ).setText( wizardTitle ); setTitle( wizardTitle ); if ( imgShell != null ) { getShell( ).setImage( imgShell ); } getShell( ).addControlListener( this ); getShell( ).addDisposeListener( this ); // Add each task to container String[] allTasks = TasksManager.instance( ) .getTasksForWizard( this.wizardBase.sWizardID ); for ( int i = 0; i < allTasks.length; i++ ) { // Create the blank tab item. CTabItem item = new CTabItem( getTabContainer( ), SWT.NONE ); item.setImage( TasksManager.instance( ) .getTask( allTasks[i] ) .getImage( ) ); item.setText( TasksManager.instance( ) .getTask( allTasks[i] ) .getTitle( ) ); item.setData( allTasks[i] ); } if ( tmpTopTaskId != null ) { int taskIndex = this.wizardBase.vTaskIDs.indexOf( tmpTopTaskId ); cmpTaskContainer.setSelection( taskIndex ); } // Open current task if ( this.wizardBase.getCurrentTask( ) != null ) { this.wizardBase.getCurrentTask( ).setContext( this.wizardBase.context ); // Do not pack wizard since the bound has been calculated by // jface this.wizardBase.packNeeded = false; this.wizardBase.switchTo( this.wizardBase.sCurrentActiveTask ); this.wizardBase.packNeeded = true; } super.initializeBounds( ); }
Example 16
Source File: MainShell.java From RepDev with GNU General Public License v3.0 | 4 votes |
public Object openFile(final SymitarFile file) { boolean found = false; Composite editor; Object loc; if (file.isLocal()) loc = file.getDir(); else loc = file.getSym(); for (CTabItem c : mainfolder.getItems()) { if (c.getData("file") != null && c.getData("file").equals(file) && c.getData("loc") != null && c.getData("loc").equals(loc)) { setMainFolderSelection(c); found = true; return c.getControl(); } } if (!found) { CTabItem item = new CTabItem(mainfolder, SWT.CLOSE); item.setText(file.getName()); // item.setToolTipText(file.getName()); // only use this if we are shrinking tabs item.setImage(getFileImage(file)); item.setData("file", file); item.setData("loc", loc); if (file.getType() == FileType.REPORT) editor = new ReportComposite(mainfolder, item, file); else { editor = new EditorComposite(mainfolder, item, file /* * ,save, * install, * print, * run */); //EditorCompositeList.add((EditorComposite)editor); } // If anything goes wrong creating the Editor, we want to fail here // It will dispose of the item to indicate this fault. if (item.isDisposed()) { MessageBox dialog = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); dialog.setMessage("There has been an error loading this file, the filename is probably too long"); dialog.setText("Error"); dialog.open(); return null; } mainfolder.setSelection(item); item.setControl(editor); setMainFolderSelection(item); mainfolder.notifyListeners(SWT.Selection, new Event()); //When we are closing, we must dispose the control in the CTabItem, otherwise we leak swt objects item.addDisposeListener(new DisposeListener(){ public void widgetDisposed(DisposeEvent e) { if(((CTabItem)e.widget).getControl() != null) ((CTabItem)e.widget).getControl().dispose(); } }); if (file.getType() != FileType.REPGEN || file.isLocal()) install.setEnabled(false); else install.setEnabled(true); if (file.getType() != FileType.REPGEN || file.isLocal()) run.setEnabled(false); else run.setEnabled(true); savetb.setEnabled(true); if ((file.getType() == FileType.REPGEN)||(file.getType() == FileType.LETTER)||(file.getType() == FileType.HELP)) hltoggle.setEnabled(true); if (mainfolder.getSelection().getControl() instanceof EditorComposite){ if(((EditorComposite)mainfolder.getSelection().getControl()).getHighlight()){ hltoggle.setImage(RepDevMain.smallHighlight); }else{ hltoggle.setImage(RepDevMain.smallHighlightGrey); } } // Attach find/replace shell here as well (in addition to folder // listener) findReplaceShell.attach(((EditorComposite) mainfolder.getSelection().getControl()).getStyledText(), true); if (!Config.getRecentFiles().contains(file)) Config.getRecentFiles().add(0, file); if (Config.getRecentFiles().size() > MAX_RECENTS) Config.getRecentFiles().remove(Config.getRecentFiles().size() - 1); return editor; } return null; }
Example 17
Source File: MainShell.java From RepDev with GNU General Public License v3.0 | 4 votes |
protected void compare() { if (tree.getSelectionCount() != 2) return; if (!(tree.getSelection()[0].getData() instanceof SymitarFile)) return; if (!(tree.getSelection()[1].getData() instanceof SymitarFile)) return; Color bgcolor = new Color(Display.getCurrent(),200,200,200); //This code gets the correct color to highlight the lines of the compare shell. //The only drawback is that it is a bit on the slow side (usually takes about 1 second). //In my opinion it is fine to take this bit of time, because the compare shell looks //hideous with a custom style without this code. Hopefully we can find a faster way to do //this, but for the time being it should work. EditorComposite temp = (EditorComposite)openFile((SymitarFile)tree.getSelection()[1].getData()); for (CTabItem tab : mainfolder.getItems()){ if (tab.getControl() != null && tab.getControl() instanceof EditorComposite){ bgcolor =((EditorComposite)mainfolder.getSelection().getControl()).getLineColor(); } if (tab.getControl() != null && tab.getControl() instanceof EditorComposite && tab.getControl() == temp){ tab.dispose(); } } //TODO:Rewrite the above section so that it runs faster, or determines the color in another way CTabItem item = new CTabItem(mainfolder, SWT.CLOSE); item.setText("Compare Text BETA"); item.setImage(RepDevMain.smallCompareImage); // item.setImage(getFileImage(file)); // item.setData("file", file); // item.setData("loc", loc); item.setControl(new CompareComposite(mainfolder, item, (SymitarFile) tree.getSelection()[0].getData(), (SymitarFile) tree.getSelection()[1].getData(), bgcolor)); item.addDisposeListener(new DisposeListener(){ public void widgetDisposed(DisposeEvent e) { if(((CTabItem)e.widget).getControl() != null) ((CTabItem)e.widget).getControl().dispose(); } }); setMainFolderSelection(item); }
Example 18
Source File: ScriptValuesModDialog.java From hop with Apache License 2.0 | 4 votes |
private void modifyCTabItem( TreeItem tItem, int iModType, String strOption ) { switch ( iModType ) { case DELETE_ITEM: CTabItem dItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( dItem != null ) { dItem.dispose(); input.setChanged(); } break; case RENAME_ITEM: CTabItem rItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( rItem != null ) { rItem.setText( strOption ); input.setChanged(); if ( rItem.getImage().equals( imageActiveScript ) ) { strActiveScript = strOption; } else if ( rItem.getImage().equals( imageActiveStartScript ) ) { strActiveStartScript = strOption; } else if ( rItem.getImage().equals( imageActiveEndScript ) ) { strActiveEndScript = strOption; } } break; case SET_ACTIVE_ITEM: CTabItem aItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( aItem != null ) { input.setChanged(); strActiveScript = tItem.getText(); for ( int i = 0; i < folder.getItemCount(); i++ ) { if ( folder.getItem( i ).equals( aItem ) ) { aItem.setImage( imageActiveScript ); } else { folder.getItem( i ).setImage( imageInactiveScript ); } } } break; default: break; } }
Example 19
Source File: ScriptDialog.java From hop with Apache License 2.0 | 4 votes |
private void modifyCTabItem( TreeItem tItem, int iModType, String strOption ) { switch ( iModType ) { case DELETE_ITEM: CTabItem dItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( dItem != null ) { dItem.dispose(); input.setChanged(); } break; case RENAME_ITEM: CTabItem rItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( rItem != null ) { rItem.setText( strOption ); input.setChanged(); if ( rItem.getImage().equals( imageActiveScript ) ) { strActiveScript = strOption; } else if ( rItem.getImage().equals( imageActiveStartScript ) ) { strActiveStartScript = strOption; } else if ( rItem.getImage().equals( imageActiveEndScript ) ) { strActiveEndScript = strOption; } } break; case SET_ACTIVE_ITEM: CTabItem aItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( aItem != null ) { input.setChanged(); strActiveScript = tItem.getText(); for ( int i = 0; i < folder.getItemCount(); i++ ) { if ( folder.getItem( i ).equals( aItem ) ) { aItem.setImage( imageActiveScript ); } else { folder.getItem( i ).setImage( imageInactiveScript ); } } } break; default: break; } }
Example 20
Source File: ScriptValuesModDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void modifyCTabItem( TreeItem tItem, int iModType, String strOption ) { switch ( iModType ) { case DELETE_ITEM: CTabItem dItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( dItem != null ) { dItem.dispose(); input.setChanged(); } break; case RENAME_ITEM: CTabItem rItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( rItem != null ) { rItem.setText( strOption ); input.setChanged(); if ( rItem.getImage().equals( imageActiveScript ) ) { strActiveScript = strOption; } else if ( rItem.getImage().equals( imageActiveStartScript ) ) { strActiveStartScript = strOption; } else if ( rItem.getImage().equals( imageActiveEndScript ) ) { strActiveEndScript = strOption; } } break; case SET_ACTIVE_ITEM: CTabItem aItem = folder.getItem( getCTabPosition( tItem.getText() ) ); if ( aItem != null ) { input.setChanged(); strActiveScript = tItem.getText(); for ( int i = 0; i < folder.getItemCount(); i++ ) { if ( folder.getItem( i ).equals( aItem ) ) { aItem.setImage( imageActiveScript ); } else { folder.getItem( i ).setImage( imageInactiveScript ); } } } break; default: break; } }