public boolean close() { boolean result; try { if (getReturnCode() == OK) { OpenTypeHistory.getInstance().save(); } } finally { result = super.close(); } return result; }
protected void computeResult() { TypeNameMatch[] selected = fContent.getSelection(); if (selected == null || selected.length == 0) { setResult(null); return; } // If the scope is null then it got computed by the type selection component. if (fScope == null) { fScope = fContent.getScope(); } OpenTypeHistory history = OpenTypeHistory.getInstance(); List result = new ArrayList(selected.length); for (int i = 0; i < selected.length; i++) { TypeNameMatch typeInfo = selected[i]; IType type = typeInfo.getType(); if (!type.exists()) { String title = JavaUIMessages.TypeSelectionDialog_errorTitle; IPackageFragmentRoot root = typeInfo.getPackageFragmentRoot(); String containerName = JavaScriptElementLabels.getElementLabel(root, JavaScriptElementLabels.ROOT_QUALIFIED); String message = Messages.format( JavaUIMessages.TypeSelectionDialog_dialogMessage, new String[] {typeInfo.getFullyQualifiedName(), containerName}); MessageDialog.openError(getShell(), title, message); history.remove(typeInfo); setResult(null); } else { history.accessed(typeInfo); result.add(type); } } setResult(result); }
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (fgFirstTime) { // Join the initialize after load job. IJobManager manager = Job.getJobManager(); manager.join(JavaScriptUI.ID_PLUGIN, monitor); } OpenTypeHistory history = OpenTypeHistory.getInstance(); if (fgFirstTime || history.isEmpty()) { monitor.beginTask(JavaUIMessages.TypeSelectionDialog_progress_consistency, 100); if (history.needConsistencyCheck()) { refreshSearchIndices(new SubProgressMonitor(monitor, 90)); history.checkConsistency(new SubProgressMonitor(monitor, 10)); } else { refreshSearchIndices(monitor); } monitor.done(); fgFirstTime = false; } else { history.checkConsistency(monitor); } }
public boolean needsExecution() { OpenTypeHistory history = OpenTypeHistory.getInstance(); return fgFirstTime || history.isEmpty() || history.needConsistencyCheck(); }