private void hackSetFile(IFile f) { try { Field field = FileEditorInput.class.getDeclaredField("file"); // $NON-NLS-1$ field.setAccessible(true); field.set(this, f); } catch (NoSuchFieldException e) { ModelUIPlugin.getPluginLog().logError(e); } catch (IllegalArgumentException e) { ModelUIPlugin.getPluginLog().logError(e); } catch (IllegalAccessException e) { ModelUIPlugin.getPluginLog().logError(e); } }
public void revalidate() { IFile f = getFile(); if (f == null || f.equals(super.getFile())) return; try { Field field = FileEditorInput.class.getDeclaredField("file"); // $NON-NLS-1$ field.setAccessible(true); field.set(this, f); } catch (NoSuchFieldException e) { ModelUIPlugin.getPluginLog().logError(e); } catch (IllegalArgumentException e) { ModelUIPlugin.getPluginLog().logError(e); } catch (IllegalAccessException e) { ModelUIPlugin.getPluginLog().logError(e); } }
protected boolean hasModelNature(IProject project) { String nature = getModelNatureName(); if (nature == null) return super.hasModelNature(project); if (project == null || !project.isAccessible()) return false; try { if (project.hasNature(nature)) return true; } catch (CoreException e) { ModelUIPlugin.getPluginLog().logError(e); } return false; }
public static IObjectActionDelegate findPopupMenusObjectAction(String pluginId, String actionId) { Platform.getBundle(pluginId); try { return (IObjectActionDelegate) ExtensionPointUtil.findClassByElementId( "org.eclipse.ui.popupMenus", actionId); // $NON-NLS-1$ } catch (CoreException ex) { ModelUIPlugin.getPluginLog().logError(ex); } return null; }
public static IImportWizard findImportWizardsItem(String pluginId, String wizardId) { Platform.getBundle(pluginId); try { return (IImportWizard) ExtensionPointUtil.findClassByElementId( "org.eclipse.ui.importWizards", wizardId); // $NON-NLS-1$ } catch (CoreException ex) { ModelUIPlugin.getPluginLog().logError(ex); } return null; }
XFilteredTree createTree(String name, XModel model) { if (model == null || name == null) return null; String classname = model.getMetaData().getMapping("FilteredTrees").getValue(name); // $NON-NLS-1$ XFilteredTree result = null; try { result = (XFilteredTree) ModelFeatureFactory.getInstance().createFeatureInstance(classname); } catch (ClassCastException e) { ModelUIPlugin.getPluginLog().logError(e); return null; } result.setModel(model); if (result.getRoot() == null) { result = null; IProject p = EclipseResourceUtil.getProject(model.getRoot()); IModelNature nature = EclipseResourceUtil.getModelNature(p); if (nature != null) { ModelUIPlugin.getPluginLog() .logInfo( "Red Hat Project " + p.getName() + " is corrupted."); // $NON-NLS-1$ //$NON-NLS-2$ } } return result; }