/** * @param baseline the baseline that is disposed * @throws CoreException with the baseline disposed information */ protected void baselineDisposed(IApiBaseline baseline) throws CoreException { throw new CoreException(new Status(IStatus.ERROR, ApiPlugin.PLUGIN_ID, ApiPlugin.REPORT_BASELINE_IS_DISPOSED, NLS.bind(Messages.BundleApiComponent_baseline_disposed, baseline.getName()), null)); } }
/** * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (obj instanceof IApiBaseline) { IApiBaseline baseline = (IApiBaseline) obj; return this.getName().equals(baseline.getName()); } return super.equals(obj); }
/** * Cleans out all but the default baseline from the in-memory cache of * baselines */ private void cleanStateCache() { if (baselinecache != null) { IApiBaseline baseline = null; for (Entry<String, IApiBaseline> entry : baselinecache.entrySet()) { baseline = entry.getValue(); if (!baseline.getName().equals(defaultbaseline)) { baseline.dispose(); hasinfos.remove(baseline.getName()); // iter.remove(); } } } }
/** * Constructs a new API component from the specified location in the file * system in the given baseline. * * @param baseline owning API baseline * @param location directory or jar file * @param bundleid * @exception CoreException if unable to create a component from the * specified location */ public BundleComponent(IApiBaseline baseline, String location, long bundleid) throws CoreException { super(baseline); fLocation = location; fBundleId = bundleid; fWorkspaceBinary = isBinary() && ApiBaselineManager.WORKSPACE_API_BASELINE_ID.equals(baseline.getName()) /* * Workaround for bad architecture, see bug 488694: We don't know if the * bundle is from the workspace , from a host workspace, or from a * target platform. If it's a file, then it's certainly not from a * workspace project, and hence can't be an imported binary bundle. */ && !new File(location).isFile(); }
/** * Returns if the specified {@link IApiProfile} is the default profile or * not * * @param element * @return if the profile is the default or not */ protected boolean isDefault(Object element) { if (element instanceof IApiBaseline) { IApiBaseline profile = (IApiBaseline) element; if (newdefault == null) { IApiBaseline def = ApiPlugin.getDefault() .getApiBaselineManager().getDefaultApiBaseline(); if (def != null) { return profile.getName().equals(def.getName()); } } else { return profile.getName().equals(newdefault); } } return false; }
/** * Returns if the specified {@link IApiProfile} is the default profile or not * @param element * @return if the profile is the default or not */ protected boolean isDefaultBaseline(Object element) { if(element instanceof IApiBaseline) { IApiBaseline profile = (IApiBaseline) element; IApiBaseline def = ApiPlugin.getDefault().getApiBaselineManager().getDefaultApiBaseline(); if(def != null) { return profile.getName().equals(def.getName()); } } return false; }
/** * Returns if the specified {@link IApiProfile} is the default profile or * not * * @param element * @return if the profile is the default or not */ protected boolean isDefault(Object element) { if (element instanceof IApiBaseline) { IApiBaseline profile = (IApiBaseline) element; if (newdefault == null) { IApiBaseline def = ApiPlugin.getDefault().getApiBaselineManager().getDefaultApiBaseline(); if (def != null) { return profile.getName().equals(def.getName()); } } else { return profile.getName().equals(newdefault); } } return false; }
/** * Returns if the specified {@link IApiProfile} is the default profile or * not * * @param element * @return if the profile is the default or not */ protected boolean isDefaultBaseline(Object element) { if (element instanceof IApiBaseline) { IApiBaseline profile = (IApiBaseline) element; IApiBaseline def = ApiPlugin.getDefault().getApiBaselineManager().getDefaultApiBaseline(); if (def != null) { return profile.getName().equals(def.getName()); } } return false; }
/** * Updates available baselines. */ void updateAvailableBaselines() { HashSet ids = new HashSet(); IApiBaseline[] baselines = ApiPlugin.getDefault().getApiBaselineManager().getApiBaselines(); for (int i = 0; i < baselines.length; i++) { ids.add(baselines[i].getName()); } this.baseline.setItems((String[]) ids.toArray(new String[ids.size()])); }
/** * Updates available baselines. */ void updateAvailableBaselines() { HashSet<String> ids = new HashSet<>(); IApiBaseline[] baselines = ApiPlugin.getDefault().getApiBaselineManager().getApiBaselines(); for (IApiBaseline apiBaseline : baselines) { ids.add(apiBaseline.getName()); } this.baseline.setItems(ids.toArray(new String[ids.size()])); }
/** * Performs the remove action, from either the Remove button or from * pressing the Delete key */ protected void doRemove() { IApiBaseline[] states = getCurrentSelection(); for (int i = 0; i < states.length; i++) { if (isDefault(states[i])) { newdefault = null; manager.setDefaultApiBaseline(null); defaultchanged = true; rebuildcount = 0; } removed.add(states[i].getName()); } if (backingcollection.removeAll(Arrays.asList(states))) { dirty = true; } tableviewer.refresh(); }
/** * Performs the remove action, from either the Remove button or from * pressing the Delete key */ protected void doRemove() { IApiBaseline[] states = getCurrentSelection(); for (IApiBaseline state : states) { if (isDefault(state)) { newdefault = null; manager.setDefaultApiBaseline(null); defaultchanged = true; rebuildcount = 0; } removed.add(state.getName()); } if (backingcollection.removeAll(Arrays.asList(states))) { dirty = true; } tableviewer.refresh(); }
private IApiTypeRoot getType(String typeName, IApiComponent component, IApiBaseline baseline) throws CoreException { String packageName = Signatures.getPackageName(typeName); IApiComponent[] components = baseline.resolvePackage(component, packageName); if (components == null) { String msg = MessageFormat.format(ComparatorMessages.ClassFileComparator_1, packageName, baseline.getName(), component.getSymbolicName()); if (ApiPlugin.DEBUG_CLASSFILE_COMPARATOR) { System.err.println("TYPE LOOKUP: " + msg); //$NON-NLS-1$ } reportStatus(new Status(IStatus.ERROR, component.getSymbolicName(), msg)); return null; } IApiTypeRoot result = Util.getClassFile(components, typeName); if (result == null) { String msg = MessageFormat.format(ComparatorMessages.ClassFileComparator_2, typeName, baseline.getName(), component.getSymbolicName()); if (ApiPlugin.DEBUG_CLASSFILE_COMPARATOR) { System.err.println("TYPE LOOKUP: " + msg); //$NON-NLS-1$ } reportStatus(new Status(IStatus.ERROR, component.getSymbolicName(), msg)); return null; } return result; }
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { IApiComponent[] components = original.getApiComponents(); IProgressMonitor localmonitor = SubMonitor.convert(monitor, WizardMessages.ApiProfileWizardPage_create_working_copy, components.length + 1); localmonitor.subTask(WizardMessages.ApiProfileWizardPage_copy_profile_attribs); workingcopy = ApiModelFactory.newApiBaseline(original.getName(), original.getLocation()); localmonitor.worked(1); localmonitor.subTask(WizardMessages.ApiProfileWizardPage_copy_api_components); ArrayList comps = new ArrayList(); IApiComponent comp = null; for(int i = 0; i < components.length; i++) { comp = ApiModelFactory.newApiComponent(workingcopy, components[i].getLocation()); if(comp != null) { comps.add(comp); } localmonitor.worked(1); } workingcopy.addApiComponents((IApiComponent[]) comps.toArray(new IApiComponent[comps.size()])); } catch(CoreException ce) { ApiUIPlugin.log(ce); } }
protected ApiBaselineWizardPage(IApiBaseline profile) { super(WizardMessages.ApiProfileWizardPage_1); this.fProfile = profile; setTitle(WizardMessages.ApiProfileWizardPage_1); if (profile == null) { setMessage(WizardMessages.ApiProfileWizardPage_3); } else { originalname = fProfile.getName(); setMessage(WizardMessages.ApiProfileWizardPage_4); } setImageDescriptor(ApiUIPlugin.getImageDescriptor(IApiToolsConstants.IMG_WIZBAN_PROFILE)); }
public void checkStateChanged(CheckStateChangedEvent event) { IApiBaseline baseline = (IApiBaseline) event.getElement(); boolean checked = event.getChecked(); if(checked) { tableviewer.setCheckedElements(new Object[] {baseline}); newdefault = baseline.getName(); defaultchanged = !newdefault.equals(origdefault); } else { tableviewer.setChecked(baseline, checked); newdefault = null; manager.setDefaultApiBaseline(null); defaultchanged = true; } rebuildcount = 0; tableviewer.refresh(true); dirty = true; } });
public void widgetSelected(SelectionEvent e) { ApiBaselineWizard wizard = new ApiBaselineWizard(null); WizardDialog dialog = new WizardDialog(ApiUIPlugin.getShell(), wizard); if(dialog.open() == IDialogConstants.OK_ID) { IApiBaseline profile = wizard.getProfile(); if(profile != null) { backingcollection.add(profile); tableviewer.refresh(); tableviewer.setSelection(new StructuredSelection(profile), true); if(backingcollection.size() == 1) { newdefault = profile.getName(); tableviewer.setCheckedElements(new Object[] {profile}); tableviewer.refresh(profile); defaultchanged = true; rebuildcount = 0; } dirty = true; } } } });