Java Code Examples for org.eclipse.swt.custom.CTabItem#getControl()
The following examples show how to use
org.eclipse.swt.custom.CTabItem#getControl() .
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: MainShell.java From RepDev with GNU General Public License v3.0 | 6 votes |
private void handleRenameItem(TreeItem item, String newName) { if (item.getData() instanceof SymitarFile) { // Set SymitarFile name if (((SymitarFile) item.getData()).saveName(newName)) item.setText(newName); // Set name in tree // Now, set name in any open tabs for (CTabItem c : mainfolder.getItems()) if (c.getData("file") == item.getData()) // Be sure it's the // exact same // instance, like it // should be { c.setText(newName); if (c.getControl() instanceof EditorComposite) { c.setData("modified", false); ((EditorComposite) c.getControl()).updateModified(); } } } if (item.getData() instanceof Project) { ((Project) item.getData()).setName(newName); item.setText(newName); } }
Example 2
Source File: ScriptDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private StyledTextComp getStyledTextComp() { CTabItem item = folder.getSelection(); if ( item.getControl().isDisposed() ) { return null; } else { return (StyledTextComp) item.getControl(); } }
Example 3
Source File: ScriptValuesModDialog.java From hop with Apache License 2.0 | 5 votes |
private StyledTextComp getStyledTextComp() { CTabItem item = folder.getSelection(); if ( item.getControl().isDisposed() ) { return null; } else { return (StyledTextComp) item.getControl(); } }
Example 4
Source File: CodeDetailView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
/** Vom ActivationListener */ public void activation(boolean mode){ CTabItem selected = ctab.getSelection(); if (selected instanceof FavoritenCTabItem || selected instanceof MakrosCTabItem) return; if (selected != null) { MasterDetailsPage page = (MasterDetailsPage) selected.getControl(); ViewerConfigurer vc = page.cv.getConfigurer(); if (mode == true) { vc.getControlFieldProvider().setFocus(); } else { vc.getControlFieldProvider().clearValues(); } } }
Example 5
Source File: CodeDetailView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void dispose(){ GlobalEventDispatcher.removeActivationListener(this, this); if ((ctab != null) && (!ctab.isDisposed())) { for (CTabItem ct : ctab.getItems()) { MasterDetailsPage page = (MasterDetailsPage) ct.getControl(); // page.cv.getViewerWidget().removeSelectionChangedListener( // GlobalEventDispatcher.getInstance().getDefaultListener()); page.cv.getConfigurer().getContentProvider().stopListening(); page.dispose(); } } }
Example 6
Source File: UserDefinedJavaClassDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private StyledTextComp getStyledTextComp() { CTabItem item = folder.getSelection(); if ( item.getControl().isDisposed() ) { return null; } else { return (StyledTextComp) item.getControl(); } }
Example 7
Source File: RelPanel.java From Rel with Apache License 2.0 | 5 votes |
private void focusOnSelectedTab() { CTabItem selectedItem = tabFolder.getSelection(); if (selectedItem != null) { Control tabControl = selectedItem.getControl(); if (tabControl != null && !tabControl.isDisposed()) tabControl.setFocus(); } }
Example 8
Source File: WizardBaseDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
public void switchTask( ) { // Set the description for each task String strDesc = this.wizardBase.getCurrentTask( ).getDescription( ); if ( strDesc != null ) { setMessage( strDesc ); } // Update or create UI if ( getTabContainer( ).getSelectionIndex( ) < 0 ) { getTabContainer( ).setSelection( 0 ); } CTabItem currentItem = getTabContainer( ).getItem( getTabContainer( ).getSelectionIndex( ) ); this.wizardBase.getCurrentTask( ).createControl( getTabContainer( ) ); if ( currentItem.getControl( ) == null ) { currentItem.setControl( this.wizardBase.getCurrentTask( ).getControl( ) ); } // Pack every task to show as much as possible packWizard( ); // Notify page changed to refresh help page firePageChanged( new PageChangedEvent( this, this.wizardBase.getCurrentTask( ) ) ); }
Example 9
Source File: ArtikelView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
/** Vom ActivationListener */ public void activation(boolean mode){ CTabItem selected = ctab.getSelection(); if(selected instanceof FavoritenCTabItem) return; if (selected != null) { MasterDetailsPage page = (MasterDetailsPage) selected.getControl(); ViewerConfigurer vc = page.cv.getConfigurer(); if (mode == true) { vc.getControlFieldProvider().setFocus(); } else { vc.getControlFieldProvider().clearValues(); } } }
Example 10
Source File: ScriptDialog.java From hop with Apache License 2.0 | 5 votes |
private StyledTextComp getStyledTextComp() { CTabItem item = folder.getSelection(); if ( item.getControl().isDisposed() ) { return null; } else { return (StyledTextComp) item.getControl(); } }
Example 11
Source File: ScriptValuesModDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private StyledTextComp getStyledTextComp() { CTabItem item = folder.getSelection(); if ( item.getControl().isDisposed() ) { return null; } else { return (StyledTextComp) item.getControl(); } }
Example 12
Source File: ComponentTitledFolder.java From arx with Apache License 2.0 | 5 votes |
/** * Selects the item with the given control * @param c */ public void setSelectedControl(Control c) { for (CTabItem item : folder.getItems()) { if (item.getControl() == c) { folder.setSelection(item); return; } } }
Example 13
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 14
Source File: ScriptDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private StyledTextComp getStyledTextComp( CTabItem item ) { return (StyledTextComp) item.getControl(); }
Example 15
Source File: ScriptValuesModDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private StyledTextComp getStyledTextComp( CTabItem item ) { return (StyledTextComp) item.getControl(); }
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: UserDefinedJavaClassDialog.java From hop with Apache License 2.0 | 4 votes |
private StyledTextComp getStyledTextComp( CTabItem item ) { return (StyledTextComp) item.getControl(); }
Example 18
Source File: UserDefinedJavaClassDialog.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private StyledTextComp getStyledTextComp( CTabItem item ) { return (StyledTextComp) item.getControl(); }
Example 19
Source File: ScriptValuesModDialog.java From hop with Apache License 2.0 | 4 votes |
private StyledTextComp getStyledTextComp( CTabItem item ) { return (StyledTextComp) item.getControl(); }
Example 20
Source File: ScriptDialog.java From hop with Apache License 2.0 | 4 votes |
private StyledTextComp getStyledTextComp( CTabItem item ) { return (StyledTextComp) item.getControl(); }