public void propertyChanged(Object source, int propId) { // When a property from the xslEditor Changes, walk the list all the listeners and notify them. Object listeners[] = listenerList.getListeners(); for (int i = 0; i < listeners.length; i++) { IPropertyListener listener = (IPropertyListener) listeners[i]; listener.propertyChanged(this, propId); } if (propId == IEditorPart.PROP_DIRTY) { if (!xmlEditor.isDirty()) { // We changed from Dirty to non dirty ==> User has saved so, // launch Convertigo engine // "touch" the parent style sheet ==> Convertigo engine will // recompile it IPath path; path = file.getRawLocation(); path = path.append("../../" + parentStyleSheetUrl); File parentFile = path.toFile(); parentFile.setLastModified(System.currentTimeMillis()); } } }
/** * Creates and adds a new page containing the given editor to this multi-page editor. The page is added at the given * index. This also hooks a property change listener on the nested editor. * * @param index * the index at which to add the page (0-based) * @param editor * the nested editor * @param input * the input for the nested editor * @exception PartInitException * if a new page could not be created * */ public void addPage(int index, IEditorPart editor, IEditorInput input) throws PartInitException { IEditorSite site = createSite(editor); // call init first so that if an exception is thrown, we have created no // new widgets editor.init(site, input); Composite parent2 = new Composite(getContainer(), getOrientation(editor)); parent2.setLayout(new FillLayout()); editor.createPartControl(parent2); editor.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propertyId) { MultiPageToolbarEditorPart.this.handlePropertyChange(propertyId); } }); // create item for page only after createPartControl has succeeded Item item = createItem(index, parent2); // remember the editor, as both data on the item, and in the list of // editors (see field comment) item.setData(editor); nestedEditors.add(editor); }
public ReferenceObservableValue(Realm realm, PopupWidget view) { super(realm); this.view = view; this.currentValue = view.getComponent(); listener = new IPropertyListener() { @Override public void propertyChanged(Object value, int propId) { if (updating) { return; } notifyIfChanged(currentValue, currentValue = getCurrentValue()); } }; this.view.addPropertyListener(listener); }
public void propertyChanged(Object source, int propId) { // When a property from the xmlEditor Changes, walk the list all the listeners and notify them. Object listeners[] = listenerList.getListeners(); for (int i = 0; i < listeners.length; i++) { IPropertyListener listener = (IPropertyListener) listeners[i]; listener.propertyChanged(this, propId); } }
public void propertyChanged(Object source, int propId) { // When a property from the jsEditor Changes, walk the list all the listeners and notify them. Object listeners[] = listenerList.getListeners(); for (int i = 0; i < listeners.length; i++) { IPropertyListener listener = (IPropertyListener) listeners[i]; listener.propertyChanged(this, propId); } }
/** * 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 } } }); }
private EntryEditor openEntryEditor(TreeNode en) throws PartInitException { final EditorInput input = new EditorInput(this, en); final IWorkbenchPage activePage = Helper.getActiveWBPage(); IEditorPart editor = activePage.findEditor(input); if(editor != null && editor instanceof IReusableEditor) { editor.setFocus(); return (EntryEditor)editor; } else { editor = activePage.openEditor(input, EntryEditor.ID); final IEditorPart entryEditor = editor; editor.addPropertyListener(new IPropertyListener() { @Override public void propertyChanged(Object source, int propId) { if(propId == EntryEditor.PROP_DIRTY) { if(entryEditor.isDirty()) { markDirty(); } firePropertyChange(PROP_DIRTY); } } }); if(editor instanceof EntryEditor) { ((EntryEditor)editor).initExpand(); } return (EntryEditor)editor; } }
public void firePropertyChange(final int propertyId) { final Object[] allListeners = _propertyListeners.getListeners(); for (final Object allListener : allListeners) { final IPropertyListener listener = (IPropertyListener) allListener; listener.propertyChanged(TourDatabase.this, propertyId); } }
public void addPropertyListener(IPropertyListener l) { if (tagStyleManager != null) { tagStyleManager.setTagStyle(TagStyle.curStyle); autoResize(); refresh(); } super.addPropertyListener(l); }
/** * Fires a property changed event. * * @param propertyId * the id of the property that changed */ protected void firePropertyChange(final int propertyId) { Object[] array = getListeners(); for (int nX = 0; nX < array.length; nX++) { final IPropertyListener l = (IPropertyListener) array[nX]; try { l.propertyChanged(WorkbenchPart.this, propertyId); } catch (RuntimeException e) { WorkbenchPlugin.log(e); } } }
private void editPageFunction(final UIComponent uic, final String functionMarker, final String propertyName) { final PageComponent page = uic.getPage(); try { // Refresh project resources for editor String projectName = page.getProject().getName(); IProject project = ConvertigoPlugin.getDefault().getProjectPluginResource(projectName); project.refreshLocal(IResource.DEPTH_INFINITE, null); // Close editor and Reopen it after file has been rewritten String relativePath = page.getProject().getMobileBuilder().getFunctionTempTsRelativePath(page); IFile file = project.getFile(relativePath); closeComponentFileEditor(file); page.getProject().getMobileBuilder().writeFunctionTempTsFile(page, functionMarker); file.refreshLocal(IResource.DEPTH_ZERO, null); // Open file in editor if (file.exists()) { IEditorInput input = new ComponentFileEditorInput(file, uic); if (input != null) { IEditorDescriptor desc = PlatformUI .getWorkbench() .getEditorRegistry() .getDefaultEditor(file.getName()); IWorkbenchPage activePage = PlatformUI .getWorkbench() .getActiveWorkbenchWindow() .getActivePage(); String editorId = desc.getId(); IEditorPart editorPart = activePage.openEditor(input, editorId); editorPart.addPropertyListener(new IPropertyListener() { boolean isFirstChange = false; @Override public void propertyChanged(Object source, int propId) { if (source instanceof ITextEditor) { if (propId == IEditorPart.PROP_DIRTY) { if (!isFirstChange) { isFirstChange = true; return; } isFirstChange = false; ITextEditor editor = (ITextEditor)source; IDocumentProvider dp = editor.getDocumentProvider(); IDocument doc = dp.getDocument(editor.getEditorInput()); String marker = MobileBuilder.getMarker(doc.get(), functionMarker); String beginMarker = "/*Begin_c8o_" + functionMarker + "*/"; String endMarker = "/*End_c8o_" + functionMarker + "*/"; String content = marker.replace(beginMarker+ System.lineSeparator(), "") .replace("\t\t"+endMarker, "") // for validator .replace("\t"+endMarker, ""); // for action FormatedContent formated = new FormatedContent(content); MobileUIComponentTreeObject.this.setPropertyValue(propertyName, formated); } } } }); } } } catch (Exception e) { ConvertigoPlugin.logException(e, "Unable to edit function for page '" + page.getName() + "'!"); } }
public void editAppComponentTsFile() { final ApplicationComponent application = getObject(); try { // Refresh project resource String projectName = application.getProject().getName(); IProject project = ConvertigoPlugin.getDefault().getProjectPluginResource(projectName); project.refreshLocal(IResource.DEPTH_INFINITE, null); // Get filepath of application.component.ts file String filePath = application.getProject().getMobileBuilder().getTempTsRelativePath(application); IFile file = project.getFile(filePath); file.refreshLocal(IResource.DEPTH_ZERO, null); // Open file in editor if (file.exists()) { IEditorInput input = new ComponentFileEditorInput(file, application); if (input != null) { IEditorDescriptor desc = PlatformUI .getWorkbench() .getEditorRegistry() .getDefaultEditor(file.getName()); IWorkbenchPage activePage = PlatformUI .getWorkbench() .getActiveWorkbenchWindow() .getActivePage(); String editorId = desc.getId(); IEditorPart editorPart = activePage.openEditor(input, editorId); editorPart.addPropertyListener(new IPropertyListener() { boolean isFirstChange = false; @Override public void propertyChanged(Object source, int propId) { if (source instanceof ITextEditor) { if (propId == IEditorPart.PROP_DIRTY) { if (!isFirstChange) { isFirstChange = true; return; } isFirstChange = false; ITextEditor editor = (ITextEditor)source; IDocumentProvider dp = editor.getDocumentProvider(); IDocument doc = dp.getDocument(editor.getEditorInput()); FormatedContent componentScriptContent = new FormatedContent(MobileBuilder.getMarkers(doc.get())); MobileApplicationComponentTreeObject.this.setPropertyValue("componentScriptContent", componentScriptContent); } } } }); } } } catch (Exception e) { ConvertigoPlugin.logException(e, "Unable to open typescript file for page '" + application.getName() + "'!"); } }
public void editPageTsFile() { final PageComponent page = (PageComponent)getObject(); try { // Refresh project resource String projectName = page.getProject().getName(); IProject project = ConvertigoPlugin.getDefault().getProjectPluginResource(projectName); project.refreshLocal(IResource.DEPTH_INFINITE, null); // Get filepath of page's temporary TypeScript file String filePath = page.getProject().getMobileBuilder().getTempTsRelativePath(page); IFile file = project.getFile(filePath); file.refreshLocal(IResource.DEPTH_ZERO, null); // Open file in editor if (file.exists()) { IEditorInput input = new ComponentFileEditorInput(file, page); if (input != null) { IEditorDescriptor desc = PlatformUI .getWorkbench() .getEditorRegistry() .getDefaultEditor(file.getName()); IWorkbenchPage activePage = PlatformUI .getWorkbench() .getActiveWorkbenchWindow() .getActivePage(); String editorId = desc.getId(); IEditorPart editorPart = activePage.openEditor(input, editorId); editorPart.addPropertyListener(new IPropertyListener() { boolean isFirstChange = false; @Override public void propertyChanged(Object source, int propId) { if (source instanceof ITextEditor) { if (propId == IEditorPart.PROP_DIRTY) { if (!isFirstChange) { isFirstChange = true; return; } isFirstChange = false; ITextEditor editor = (ITextEditor)source; IDocumentProvider dp = editor.getDocumentProvider(); IDocument doc = dp.getDocument(editor.getEditorInput()); FormatedContent scriptContent = new FormatedContent(MobileBuilder.getMarkers(doc.get())); MobilePageComponentTreeObject.this.setPropertyValue("scriptContent", scriptContent); } } } }); } } } catch (Exception e) { ConvertigoPlugin.logException(e, "Unable to open typescript file for page '" + page.getName() + "'!"); } }
@Override public void removePropertyListener(IPropertyListener l) { if (listenerList != null) { listenerList.remove(l); } }
@Override public void addPropertyListener(IPropertyListener listener) { }
@Override public void removePropertyListener(IPropertyListener listener) { }
public ExecutionDataContent() { clear(); listeners = new ArrayList<IPropertyListener>(); }
public void addPropertyListener(IPropertyListener listener) { if (!listeners.contains(listener)) { listeners.add(listener); } }
public void removePropertyListener(IPropertyListener listener) { listeners.remove(listener); }
private void fireChangedEvent() { for (final IPropertyListener l : listeners) { l.propertyChanged(this, 0); } }
public void removePropertyListener(IPropertyListener listener) { }