org.eclipse.ui.IWorkbenchPartConstants Java Examples
The following examples show how to use
org.eclipse.ui.IWorkbenchPartConstants.
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: MultiPageReportEditor.java From birt with Eclipse Public License 1.0 | 6 votes |
public void doSaveAs( ) { getActivePageInstance( ).doSaveAs( ); setInput( getActivePageInstance( ).getEditorInput( ) ); // update site name IReportProvider provider = getProvider( ); if ( provider != null ) { setPartName( provider.getInputPath( getEditorInput( ) ) .lastSegment( ) ); firePropertyChange( IWorkbenchPartConstants.PROP_PART_NAME ); getProvider( ).getReportModuleHandle( getEditorInput( ) ) .setFileName( getProvider( ).getInputPath( getEditorInput( ) ) .toOSString( ) ); } updateRelatedViews( ); fireDesignFileChangeEvent( ); }
Example #2
Source File: OpenModuleHandler.java From tlaplus with MIT License | 5 votes |
/** * This was the body of the <code>execute</code>, but was pulled out so it could be * used in other places to open a module. * * @param moduleName */ public static void openModule(String moduleName) { if (moduleName == null) { throw new RuntimeException("Module was null" ); } Spec spec = Activator.getSpecManager().getSpecLoaded(); final IFile module = ResourceHelper.getLinkedFile(spec.getProject(), ResourceHelper.getModuleFileName(moduleName)); if (module == null) { throw new RuntimeException("Module " + moduleName + " could not be found" ); } // open the editor IEditorPart part = UIHelper.openEditor(OpenSpecHandler.TLA_EDITOR, new FileEditorInput(module)); part.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propId) { if (IWorkbenchPartConstants.PROP_DIRTY == propId) { // here the listeners to editor changes go into } } }); }
Example #3
Source File: IDEMultiPageReportEditor.java From birt with Eclipse Public License 1.0 | 5 votes |
private void setAllInput( FileEditorInput input ) { // This for a bug. When close editor, the resource listener fire to // multi page editor, but all embedded pages disposed. if ( pages == null ) { return; } setInput( input ); if ( getEditorInput( ) != null ) { setPartName( getEditorInput( ).getName( ) ); firePropertyChange( IWorkbenchPartConstants.PROP_PART_NAME ); firePropertyChange( IWorkbenchPartConstants.PROP_PART_NAME ); getProvider( ).getReportModuleHandle( getEditorInput( ) ) .setFileName( getProvider( ).getInputPath( getEditorInput( ) ) .toOSString( ) ); } for ( Iterator it = pages.iterator( ); it.hasNext( ); ) { Object page = it.next( ); if ( page instanceof IReportEditorPage ) { ( (IReportEditorPage) page ).setInput( input ); } } updateRelatedViews( ); }
Example #4
Source File: ReportEditorProxy.java From birt with Eclipse Public License 1.0 | 5 votes |
public void propertyChanged( Object source, int propId ) { if ( propId == IWorkbenchPartConstants.PROP_PART_NAME ) { setPartName( instance.getPartName( ) ); } firePropertyChange( propId ); }
Example #5
Source File: ImageViewerEditor.java From eclipse-extras with Eclipse Public License 1.0 | 4 votes |
private void handlePropertyChangedEvent( int propertyId ) { if( propertyId == IWorkbenchPartConstants.PROP_INPUT ) { updateContent(); } }
Example #6
Source File: EditIgnoredCaughtExceptions.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void run() { IPath ignoreThrownExceptionsPath = PyExceptionBreakPointManager .getInstance().ignoreCaughtExceptionsWhenThrownFrom .getIgnoreThrownExceptionsPath(); File file = ignoreThrownExceptionsPath.toFile(); IEditorPart openFile = EditorUtils.openFile(file); if (openFile instanceof ITextEditor) { final ITextEditor textEditor = (ITextEditor) openFile; IDocumentProvider documentProvider = textEditor.getDocumentProvider(); final IEditorInput input = openFile.getEditorInput(); if (documentProvider instanceof IStorageDocumentProvider) { IStorageDocumentProvider storageDocumentProvider = (IStorageDocumentProvider) documentProvider; // Make sure the file is seen as UTF-8. storageDocumentProvider.setEncoding(input, "utf-8"); textEditor.doRevertToSaved(); } if (textEditor instanceof ISaveablePart) { IPropertyListener listener = new IPropertyListener() { @Override public void propertyChanged(Object source, int propId) { if (propId == IWorkbenchPartConstants.PROP_DIRTY) { if (source == textEditor) { if (textEditor.getEditorInput() == input) { if (!textEditor.isDirty()) { PyExceptionBreakPointManager.getInstance().ignoreCaughtExceptionsWhenThrownFrom .updateIgnoreThrownExceptions(); } } } } } }; textEditor.addPropertyListener(listener); } } // Code to provide a dialog to edit it (decided on opening the file instead). // Collection<IgnoredExceptionInfo> ignoreThrownExceptionsForEdition = PyExceptionBreakPointManager.getInstance() // .getIgnoreThrownExceptionsForEdition(); // HashMap<String, String> map = new HashMap<>(); // for (IgnoredExceptionInfo ignoredExceptionInfo : ignoreThrownExceptionsForEdition) { // map.put(ignoredExceptionInfo.filename + ": " + ignoredExceptionInfo.line, ignoredExceptionInfo.contents); // } // // EditIgnoredCaughtExceptionsDialog dialog = new EditIgnoredCaughtExceptionsDialog(EditorUtils.getShell(), map); // int open = dialog.open(); // if (open == dialog.OK) { // Map<String, String> result = dialog.getResult(); // // } else { // System.out.println("Cancel"); // } }