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( ); }
/** * 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 } } }); }
public void propertyChanged(Object source, int propId) { if (propId == IWorkbenchPartConstants.PROP_TITLE && lastActiveEditor != null) { String newTitle = lastActiveEditor.getTitle(); if (!lastEditorTitle.equals(newTitle)) { recomputeTitle(); } } }
/** * Sets the input to this editor. * * <p><b>Note:</b> Clients must fire the {@link IEditorPart#PROP_INPUT } * property change within their implementation of * <code>setInput()</code>.<p> * * @param input the editor input */ @Override public void setInput(IEditorInput input) { super.setInput(input); if (treeViewer != null) { PlanEditorModel model = PlanEditorModelRegistry.getPlanEditorModel(input); treeViewer.setInput(model.getEPlan()); treeViewer.setEditorModel(model); } firePropertyChange(IWorkbenchPartConstants.PROP_INPUT); }
@Override public void setInput(IEditorInput input) { super.setInput(input); if (daysComposite != null) { daysComposite.setInput(input); } firePropertyChange(IWorkbenchPartConstants.PROP_INPUT); }
/** * Required by IReusableEditor - change our editor to a new input. * Unconditionally remove the existing input if there is one, undoing listeners and providers. * If the given input is not null, set the editor to work on it. Finally, notify that the * dirty and input properties have changed. * @param input the new input which is to replace the existing input */ @Override public void setInput(IEditorInput input) { unsetOldInput(); if (input == null) { setPartName("<disposed>"); } else { setNewInput(input); } setPageInputs(input); firePropertyChange(ISaveablePart.PROP_DIRTY); // following the instructions from the javadoc on IReusableEditor firePropertyChange(IWorkbenchPartConstants.PROP_INPUT); }
void internalSetContentDescription(String description) { Assert.isNotNull(description); // Do not send changes if they are the same // if (Util.equals(contentDescription, description)) { // return; // } this.contentDescription = description; firePropertyChange(IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION); }
void internalSetPartName(String partName) { // partName = Util.safeString(partName); Assert.isNotNull(partName); // Do not send changes if they are the same // if (Util.equals(this.partName, partName)) { // return; // } this.partName = partName; firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME); }
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( ); }
public void propertyChanged( Object source, int propId ) { if ( propId == IWorkbenchPartConstants.PROP_PART_NAME ) { setPartName( instance.getPartName( ) ); } firePropertyChange( propId ); }
protected void setDirty(boolean newValue) { if (this.isDirty != newValue) { this.isDirty = newValue; firePropertyChange(IWorkbenchPartConstants.PROP_DIRTY); } }
private void handlePropertyChangedEvent( int propertyId ) { if( propertyId == IWorkbenchPartConstants.PROP_INPUT ) { updateContent(); } }
/** * @param property one of IWorkbenchPartConstants.PROP_ constants * */ public void refresh(int property) { switch (property) { case IWorkbenchPartConstants.PROP_DIRTY: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:dirty"); } setToolTipText(tabArea.getPresentation().getPartTooltip(part)); setPartText(null); partIsDirty = part.isDirty(); tabArea.layoutTabs(); break; case IWorkbenchPartConstants.PROP_TITLE: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:changed title"); } setToolTipText(tabArea.getPresentation().getPartTooltip(part)); setPartText(null); break; case IWorkbenchPartConstants.PROP_PART_NAME: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:changed name"); } setToolTipText(tabArea.getPresentation().getPartTooltip(part)); setPartText(null); break; case IWorkbenchPartConstants.PROP_INPUT: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:changed input"); } setToolTipText(tabArea.getPresentation().getPartTooltip(part)); setPartText(null); break; case IWorkbenchPartConstants.PROP_PREFERRED_SIZE: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:changed pref_size"); } break; case IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:changed content descr"); } break; default: if(PresentationPlugin.DEBUG_STATE) { System.out.println("PartTab:changed?"); } return; } if(!isHidden()) { redraw(); } }
public void propertyChanged(Object source, int propId) { if (propId == IWorkbenchPartConstants.PROP_TITLE) { setDefaultContentDescription(); } }
public void propertyChanged(Object source, int propId) { if (propId == IWorkbenchPartConstants.PROP_TITLE) { setDefaultPartName(); } }
@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"); // } }