org.eclipse.cdt.codan.ui_2.0.1.201202111925

16:41:37.008 INFO  jd.cli.Main - Decompiling org.eclipse.cdt.codan.ui_2.0.1.201202111925.jar
package org.eclipse.cdt.codan.ui.handlers;

import org.eclipse.cdt.codan.internal.ui.actions.RunCodeAnalysis;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.handlers.HandlerUtil;

public class RunCodanCommand
  extends AbstractHandler
{
  public Object execute(ExecutionEvent event)
    throws ExecutionException
  {
    ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
    RunCodeAnalysis action = new RunCodeAnalysis();
    action.selectionChanged(null, currentSelection);
    action.run(null);
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.ui.handlers.RunCodanCommand
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.ui;

import org.eclipse.core.resources.IMarker;
import org.eclipse.ui.IMarkerResolution;

public abstract interface ICodanMarkerResolution
  extends IMarkerResolution
{
  public abstract boolean isApplicable(IMarker paramIMarker);
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.ui.ICodanMarkerResolution
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.ui;

import java.io.File;
import java.net.URI;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.ide.ResourceUtil;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;

public class CodanEditorUtility
{
  public static void openFileURL(String fileUrl, IResource markerResource)
    throws PartInitException, BadLocationException
  {
    String file = getFileFromURL(fileUrl);
    IEditorPart part = openInEditor(file, markerResource);
    int line = getLineFromURL(fileUrl);
    revealLine(part, line);
  }
  
  public static int getLineFromURL(String fileUrl)
  {
    String sline = fileUrl.replaceAll(".*#(\\d+)$", "$1");
    int line = -1;
    try
    {
      line = Integer.parseInt(sline);
    }
    catch (NumberFormatException localNumberFormatException) {}
    return line;
  }
  
  public static String getFileFromURL(String link)
  {
    String file = link.replaceFirst("^file:", "");
    file = file.replaceAll("#\\d+$", "");
    return file;
  }
  
  public static void revealLine(IEditorPart part, int line)
    throws BadLocationException
  {
    if ((line > 0) && 
      ((part instanceof ITextEditor)))
    {
      ITextEditor textEditor = (ITextEditor)part;
      IDocument document = textEditor.getDocumentProvider().getDocument(part.getEditorInput());
      textEditor.selectAndReveal(document.getLineOffset(line - 1), 0);
    }
  }
  
  public static IEditorPart openInEditor(String file, IResource markerResource)
    throws PartInitException
  {
    IFile efile = null;
    if ((markerResource instanceof IFile)) {
      efile = (IFile)markerResource;
    }
    if (efile != null)
    {
      IWorkbenchPage page = getActivePage();
      IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file);
      IEditorPart part = page.openEditor(new FileEditorInput(efile), desc.getId());
      return part;
    }
    File fileToOpen = new File(file);
    if ((fileToOpen.exists()) && (fileToOpen.isFile()))
    {
      IFileStore fileStore = EFS.getLocalFileSystem().getStore(fileToOpen.toURI());
      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
      try
      {
        return IDE.openEditorOnFileStore(page, fileStore);
      }
      catch (PartInitException localPartInitException) {}
    }
    return null;
  }
  
  public static IEditorPart openInEditor(IMarker marker)
    throws PartInitException
  {
    String href = getLocationHRef(marker);
    String file = getFileFromURL(href);
    return openInEditor(file, marker.getResource());
  }
  
  public static String getLocationHRef(IMarker marker)
  {
    String loc = marker.getResource().getLocationURI().toString();
    String loc2 = marker.getAttribute("location", "");
    int line = marker.getAttribute("lineNumber", 0);
    if (loc2.length() > 0) {
      loc = "file:" + loc2.replaceAll("[^:]*: ", "");
    }
    String href = loc + "#" + line;
    return href;
  }
  
  public static String getLocation(IMarker marker)
  {
    String loc = marker.getResource().getFullPath().toPortableString();
    String loc2 = marker.getAttribute("location", "");
    int line = marker.getAttribute("lineNumber", 0);
    if (loc2.length() > 0) {
      loc = loc2.replaceAll("[^:]*: ", "");
    }
    return loc + ":" + line;
  }
  
  public static boolean isResourceOpenInEditor(IResource resource, IEditorPart editor)
  {
    if (editor == null) {
      return false;
    }
    IResource realResource = ResourceUtil.getResource(editor.getEditorInput());
    return resource.equals(realResource);
  }
  
  public static IEditorPart getActiveEditor()
  {
    IWorkbenchPage activePage = getActivePage();
    if (activePage == null) {
      return null;
    }
    IEditorPart e = activePage.getActiveEditor();
    return e;
  }
  
  private static IWorkbenchPage getActivePage()
  {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow == null) {
      return null;
    }
    IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
    return activePage;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.ui.CodanEditorUtility
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.ui;

import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
import org.eclipse.cdt.codan.internal.core.model.CodanProblemMarker;
import org.eclipse.core.resources.IMarker;

public abstract class AbstractCodanProblemDetailsProvider
{
  protected IMarker marker;
  
  public void setMarker(IMarker marker)
  {
    this.marker = marker;
  }
  
  public IMarker getMarker()
  {
    return marker;
  }
  
  protected String getProblemMessage()
  {
    String message = marker.getAttribute("message", "");
    return message;
  }
  
  protected String getProblemId()
  {
    String id = marker.getAttribute("id", null);
    return id;
  }
  
  public abstract boolean isApplicable(String paramString);
  
  public String getProblemArgument(int index)
  {
    return CodanProblemMarker.getProblemArgument(marker, index);
  }
  
  public String[] getProblemArguments()
  {
    return CodanProblemMarker.getProblemArguments(marker);
  }
  
  public String getStyledProblemMessage()
  {
    String message = escapeForLink(getProblemMessage());
    String href = getLocationHRef();
    String link = getLocation();
    return "<a href=\"" + href + "\">" + link + "</a> \n" + message + "\n";
  }
  
  protected String getLocationHRef()
  {
    return CodanEditorUtility.getLocationHRef(marker);
  }
  
  protected String getLocation()
  {
    return CodanEditorUtility.getLocation(marker);
  }
  
  public String getStyledProblemDescription()
  {
    String id = getProblemId();
    if (id == null) {
      return "";
    }
    IProblem problem = CodanRuntime.getInstance().getCheckersRegistry().getDefaultProfile().findProblem(id);
    String desc = problem.getDescription();
    if (desc == null) {
      return "";
    }
    return escapeForLink(desc);
  }
  
  protected String escapeForLink(String text)
  {
    return text.replaceAll("&", "&&");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.ui;

import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

public class LabelFieldEditor
  extends FieldEditor
{
  private Label label;
  
  public LabelFieldEditor(String labelText, Composite parent)
  {
    super("label", labelText, parent);
  }
  
  protected void adjustForNumColumns(int numColumns)
  {
    label.getLayoutData()).horizontalSpan = numColumns;
  }
  
  protected void doFillIntoGrid(Composite parent, int numColumns)
  {
    label = getLabelControl(parent);
    GridData gridData = new GridData();
    horizontalSpan = numColumns;
    horizontalAlignment = 4;
    grabExcessHorizontalSpace = false;
    verticalAlignment = 2;
    grabExcessVerticalSpace = false;
    label.setLayoutData(gridData);
  }
  
  public int getNumberOfControls()
  {
    return 1;
  }
  
  protected void doLoad() {}
  
  protected void doLoadDefault() {}
  
  protected void doStore() {}
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.ui.LabelFieldEditor
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.dialogs;

import java.text.MessageFormat;
import java.util.List;
import org.eclipse.cdt.codan.core.param.FileScopeProblemPreference;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.cdt.codan.internal.ui.widgets.BasicElementLabels;
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.StatusDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;

public class ExclusionInclusionEntryDialog
  extends StatusDialog
{
  private StringButtonDialogField fExclusionPatternDialog;
  private StatusInfo fExclusionPatternStatus;
  private IContainer fCurrSourceFolder;
  private String fExclusionPattern;
  private List fExistingPatterns;
  private boolean fIsExclusion;
  
  public ExclusionInclusionEntryDialog(Shell parent, boolean isExclusion, String patternToEdit, List existingPatterns, FileScopeProblemPreference entryToEdit)
  {
    super(parent);
    fIsExclusion = isExclusion;
    fExistingPatterns = existingPatterns;
    String message;
    String title;
    String message;
    if (isExclusion)
    {
      String title;
      String title;
      if (patternToEdit == null) {
        title = CodanUIMessages.ExclusionInclusionEntryDialog_exclude_add_title;
      } else {
        title = CodanUIMessages.ExclusionInclusionEntryDialog_exclude_edit_title;
      }
      message = MessageFormat.format(CodanUIMessages.ExclusionInclusionEntryDialog_exclude_pattern_label, new Object[] {
        BasicElementLabels.getPathLabel(entryToEdit.getPath(), false) });
    }
    else
    {
      String title;
      if (patternToEdit == null) {
        title = CodanUIMessages.ExclusionInclusionEntryDialog_include_add_title;
      } else {
        title = CodanUIMessages.ExclusionInclusionEntryDialog_include_edit_title;
      }
      message = MessageFormat.format(CodanUIMessages.ExclusionInclusionEntryDialog_include_pattern_label, new Object[] {
        BasicElementLabels.getPathLabel(entryToEdit.getPath(), false) });
    }
    setTitle(title);
    if (patternToEdit != null) {
      fExistingPatterns.remove(patternToEdit);
    }
    IProject currProject = entryToEdit.getProject();
    IWorkspaceRoot root = currProject != null ? currProject.getWorkspace().getRoot() : ResourcesPlugin.getWorkspace().getRoot();
    IResource res = root.findMember(entryToEdit.getPath());
    if ((res instanceof IContainer)) {
      fCurrSourceFolder = ((IContainer)res);
    }
    fExclusionPatternStatus = new StatusInfo();
    ExclusionPatternAdapter adapter = new ExclusionPatternAdapter(null);
    fExclusionPatternDialog = new StringButtonDialogField(adapter);
    fExclusionPatternDialog.setLabelText(message);
    fExclusionPatternDialog.setButtonLabel(CodanUIMessages.ExclusionInclusionEntryDialog_pattern_button);
    fExclusionPatternDialog.setDialogFieldListener(adapter);
    fExclusionPatternDialog.enableButton(fCurrSourceFolder != null);
    if (patternToEdit == null) {
      fExclusionPatternDialog.setText("");
    } else {
      fExclusionPatternDialog.setText(patternToEdit.toString());
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = (Composite)super.createDialogArea(parent);
    int widthHint = convertWidthInCharsToPixels(60);
    Composite inner = new Composite(composite, 0);
    GridLayout layout = new GridLayout();
    marginHeight = 0;
    marginWidth = 0;
    numColumns = 2;
    inner.setLayout(layout);
    Label description = new Label(inner, 64);
    if (fIsExclusion) {
      description.setText(CodanUIMessages.ExclusionInclusionEntryDialog_exclude_description);
    } else {
      description.setText(CodanUIMessages.ExclusionInclusionEntryDialog_include_description);
    }
    GridData gd = new GridData();
    horizontalSpan = 2;
    widthHint = convertWidthInCharsToPixels(80);
    description.setLayoutData(gd);
    fExclusionPatternDialog.doFillIntoGrid(inner, 3);
    LayoutUtil.setWidthHint(fExclusionPatternDialog.getLabelControl(null), widthHint);
    LayoutUtil.setHorizontalSpan(fExclusionPatternDialog.getLabelControl(null), 2);
    LayoutUtil.setWidthHint(fExclusionPatternDialog.getTextControl(null), widthHint);
    LayoutUtil.setHorizontalGrabbing(fExclusionPatternDialog.getTextControl(null), true);
    fExclusionPatternDialog.postSetFocusOnDialogField(parent.getDisplay());
    applyDialogFont(composite);
    return composite;
  }
  
  private class ExclusionPatternAdapter
    implements IDialogFieldListener, IStringButtonAdapter
  {
    private ExclusionPatternAdapter() {}
    
    public void dialogFieldChanged(DialogField field)
    {
      doStatusLineUpdate();
    }
    
    public void changeControlPressed(DialogField field)
    {
      doChangeControlPressed();
    }
  }
  
  protected void doChangeControlPressed()
  {
    IPath pattern = chooseExclusionPattern();
    if (pattern != null) {
      fExclusionPatternDialog.setText(pattern.toString());
    }
  }
  
  protected void doStatusLineUpdate()
  {
    checkIfPatternValid();
    updateStatus(fExclusionPatternStatus);
  }
  
  protected void checkIfPatternValid()
  {
    String pattern = fExclusionPatternDialog.getText().trim();
    if (pattern.length() == 0)
    {
      fExclusionPatternStatus.setError(CodanUIMessages.ExclusionInclusionEntryDialog_error_empty);
      return;
    }
    IPath path = new Path(pattern);
    if ((path.isAbsolute()) || (path.getDevice() != null))
    {
      fExclusionPatternStatus.setError(CodanUIMessages.ExclusionInclusionEntryDialog_error_notrelative);
      return;
    }
    if (fExistingPatterns.contains(pattern))
    {
      fExclusionPatternStatus.setError(CodanUIMessages.ExclusionInclusionEntryDialog_error_exists);
      return;
    }
    fExclusionPattern = pattern;
    fExclusionPatternStatus.setOK();
  }
  
  public String getExclusionPattern()
  {
    return fExclusionPattern;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
  }
  
  private IPath chooseExclusionPattern()
  {
    String message;
    String title;
    String message;
    if (fIsExclusion)
    {
      String title = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseExclusionPattern_title;
      message = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseExclusionPattern_description;
    }
    else
    {
      title = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseInclusionPattern_title;
      message = CodanUIMessages.ExclusionInclusionEntryDialog_ChooseInclusionPattern_description;
    }
    IPath initialPath = new Path(fExclusionPatternDialog.getText());
    IPath[] res = chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, initialPath, false);
    if (res == null) {
      return null;
    }
    return res[0];
  }
  
  public static IPath[] chooseExclusionPattern(Shell shell, IContainer currentSourceFolder, String title, String message, IPath initialPath, boolean multiSelection)
  {
    Class[] acceptedClasses = { IFolder.class, IFile.class, IProject.class };
    ISelectionStatusValidator validator = new TypedElementSelectionValidator(acceptedClasses, multiSelection);
    ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
    ILabelProvider lp = new WorkbenchLabelProvider();
    ITreeContentProvider cp = new WorkbenchContentProvider();
    IResource initialElement = null;
    if (initialPath != null)
    {
      IContainer curr = currentSourceFolder;
      int nSegments = initialPath.segmentCount();
      for (int i = 0; i < nSegments; i++)
      {
        IResource elem = curr.findMember(initialPath.segment(i));
        if (elem != null) {
          initialElement = elem;
        }
        if (!(elem instanceof IContainer)) {
          break;
        }
        curr = (IContainer)elem;
      }
    }
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell, lp, cp);
    dialog.setTitle(title);
    dialog.setValidator(validator);
    dialog.setMessage(message);
    dialog.addFilter(filter);
    dialog.setInput(currentSourceFolder);
    dialog.setInitialSelection(initialElement);
    dialog.setComparator(new ResourceComparator(1));
    dialog.setHelpAvailable(false);
    if (dialog.open() == 0)
    {
      Object[] objects = dialog.getResult();
      int existingSegments = currentSourceFolder.getFullPath().segmentCount();
      IPath[] resArr = new IPath[objects.length];
      for (int i = 0; i < objects.length; i++)
      {
        IResource currRes = (IResource)objects[i];
        IPath path = currRes.getFullPath().removeFirstSegments(existingSegments).makeRelative();
        if ((currRes instanceof IContainer)) {
          path = path.addTrailingSeparator();
        }
        resArr[i] = path;
      }
      return resArr;
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.dialogs.ExclusionInclusionEntryDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.dialogs;

import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;

class ExclusionInclusionEntryDialog$ExclusionPatternAdapter
  implements IDialogFieldListener, IStringButtonAdapter
{
  private ExclusionInclusionEntryDialog$ExclusionPatternAdapter(ExclusionInclusionEntryDialog paramExclusionInclusionEntryDialog) {}
  
  public void dialogFieldChanged(DialogField field)
  {
    this$0.doStatusLineUpdate();
  }
  
  public void changeControlPressed(DialogField field)
  {
    this$0.doChangeControlPressed();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.dialogs.ExclusionInclusionEntryDialog.ExclusionPatternAdapter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.dialogs;

import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.core.param.RootProblemPreference;
import org.eclipse.cdt.codan.internal.core.model.CodanProblem;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.cdt.codan.internal.ui.widgets.CustomizeProblemComposite;
import org.eclipse.cdt.codan.internal.ui.widgets.ParametersComposite;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

public class CustomizeProblemDialog
  extends TitleAreaDialog
{
  private CustomizeProblemComposite comp;
  private IProblem problem;
  private IProblem[] problems;
  private IResource resource;
  
  public CustomizeProblemDialog(Shell parentShell, IProblem[] selectedProblems, IResource resource)
  {
    super(parentShell);
    problems = selectedProblems;
    problem = buildCombined(selectedProblems);
    this.resource = resource;
    setShellStyle(getShellStyle() | 0x10);
  }
  
  private IProblem buildCombined(IProblem[] selectedProblems)
  {
    if (selectedProblems.length == 0) {
      return null;
    }
    IProblem one = selectedProblems[0];
    if (selectedProblems.length == 1) {
      return one;
    }
    CodanProblem problem = new CodanProblem("multi", getTitle());
    problem.setMessagePattern(ParametersComposite.NO_CHANGE);
    problem.setPreference(new RootProblemPreference());
    problem.setSeverity(one.getSeverity());
    problem.setEnabled(one.isEnabled());
    if ((one.getPreference() instanceof RootProblemPreference))
    {
      RootProblemPreference onepref = (RootProblemPreference)one.getPreference();
      RootProblemPreference pref = (RootProblemPreference)problem.getPreference();
      pref.addChildDescriptor(onepref.getLaunchModePreference());
      pref.addChildDescriptor(onepref.getScopePreference());
    }
    return problem;
  }
  
  public void save(IProblemWorkingCopy problem)
  {
    comp.save(problem);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    getShell().setText(CodanUIMessages.CustomizeProblemDialog_Title);
    setTitle(getTitle());
    setMessage(CodanUIMessages.CustomizeProblemDialog_Message);
    Composite area = (Composite)super.createDialogArea(parent);
    comp = new CustomizeProblemComposite(area, problem, resource);
    GridData ld = new GridData(1808);
    minimumHeight = 300;
    comp.setLayoutData(ld);
    return area;
  }
  
  public String getTitle()
  {
    if (problems.length == 1) {
      return problem.getName();
    }
    String b = "";
    for (int i = 0; i < problems.length; i++)
    {
      IProblem p = problems[i];
      if (i != 0) {
        b = b + ", ";
      }
      b = b + p.getName();
    }
    return b;
  }
  
  protected void okPressed()
  {
    for (int i = 0; i < problems.length; i++)
    {
      IProblemWorkingCopy wc = (IProblemWorkingCopy)problems[i];
      save(wc);
    }
    super.okPressed();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.dialogs.CustomizeProblemDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.views;

import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
import org.eclipse.cdt.codan.ui.CodanEditorUtility;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.program.Program;
import org.eclipse.ui.PartInitException;

class ProblemDetails$1
  extends SelectionAdapter
{
  ProblemDetails$1(ProblemDetails paramProblemDetails) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    String link = text;
    if (link == null) {
      return;
    }
    if (link.startsWith("http"))
    {
      Program.launch(text);
      return;
    }
    if (link.startsWith("file:"))
    {
      try
      {
        CodanEditorUtility.openFileURL(link, ProblemDetails.access$0(this$0).getMarker().getResource());
      }
      catch (PartInitException e1)
      {
        CodanUIActivator.log(e1);
      }
      catch (BadLocationException e1)
      {
        CodanUIActivator.log(e1);
      }
      return;
    }
    if (link.startsWith("help:")) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.views.ProblemDetails.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.views;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;

public class ProblemDetailsExtensions
{
  public static final String ALL = "*";
  private static final String EXTENSION_POINT_NAME = "codanProblemDetails";
  private static boolean extensionsLoaded;
  private static HashMap<String, Collection<?>> map = new HashMap();
  
  /* Error */
  private static synchronized void readExtensions()
  {
    // Byte code:
    //   0: getstatic 153	org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions:extensionsLoaded	Z
    //   3: ifeq +4 -> 7
    //   6: return
    //   7: invokestatic 169	org/eclipse/core/runtime/Platform:getExtensionRegistry	()Lorg/eclipse/core/runtime/IExtensionRegistry;
    //   10: ldc 4
    //   12: ldc 3
    //   14: invokeinterface 180 3 0
    //   19: astore_0
    //   20: aload_0
    //   21: ifnonnull +4 -> 25
    //   24: return
    //   25: aload_0
    //   26: invokeinterface 179 1 0
    //   31: astore_1
    //   32: iconst_0
    //   33: istore_2
    //   34: goto +14 -> 48
    //   37: aload_1
    //   38: iload_2
    //   39: aaload
    //   40: astore_3
    //   41: aload_3
    //   42: invokestatic 164	org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions:processDetails	(Lorg/eclipse/core/runtime/IConfigurationElement;)V
    //   45: iinc 2 1
    //   48: iload_2
    //   49: aload_1
    //   50: arraylength
    //   51: if_icmplt -14 -> 37
    //   54: goto +12 -> 66
    //   57: astore 4
    //   59: iconst_1
    //   60: putstatic 153	org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions:extensionsLoaded	Z
    //   63: aload 4
    //   65: athrow
    //   66: iconst_1
    //   67: putstatic 153	org/eclipse/cdt/codan/internal/ui/views/ProblemDetailsExtensions:extensionsLoaded	Z
    //   70: return
    // Line number table:
    //   Java source line #35	-> byte code offset #0
    //   Java source line #36	-> byte code offset #6
    //   Java source line #37	-> byte code offset #7
    //   Java source line #38	-> byte code offset #20
    //   Java source line #39	-> byte code offset #24
    //   Java source line #41	-> byte code offset #25
    //   Java source line #43	-> byte code offset #32
    //   Java source line #44	-> byte code offset #37
    //   Java source line #45	-> byte code offset #41
    //   Java source line #43	-> byte code offset #45
    //   Java source line #47	-> byte code offset #57
    //   Java source line #48	-> byte code offset #59
    //   Java source line #49	-> byte code offset #63
    //   Java source line #48	-> byte code offset #66
    //   Java source line #50	-> byte code offset #70
    // Local variable table:
    //   start	length	slot	name	signature
    //   19	7	0	ep	org.eclipse.core.runtime.IExtensionPoint
    //   31	19	1	elements	IConfigurationElement[]
    //   33	16	2	i	int
    //   40	2	3	configurationElement	IConfigurationElement
    //   57	7	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   25	57	57	finally
  }
  
  private static void processDetails(IConfigurationElement configurationElement)
  {
    if (configurationElement.getName().equals("problemDetails"))
    {
      String id = configurationElement.getAttribute("problemId");
      if (id == null) {
        id = "*";
      }
      addExtension(id, configurationElement);
    }
  }
  
  public static AbstractCodanProblemDetailsProvider resolveClass(IConfigurationElement configurationElement)
  {
    try
    {
      res = (AbstractCodanProblemDetailsProvider)configurationElement.createExecutableExtension("class");
    }
    catch (CoreException e)
    {
      AbstractCodanProblemDetailsProvider res;
      CodanUIActivator.log(e);
      return null;
    }
    AbstractCodanProblemDetailsProvider res;
    return res;
  }
  
  private static void addExtension(String id, IConfigurationElement configurationElement)
  {
    Collection collection = getCollection(id);
    collection.add(configurationElement);
  }
  
  public static void removeExtension(String id, Object el)
  {
    Collection collection = getCollection(id);
    collection.remove(el);
  }
  
  private static Collection getCollection(String id)
  {
    Collection collection = (Collection)map.get(id);
    if (collection == null)
    {
      collection = new ArrayList();
      map.put(id, collection);
    }
    return collection;
  }
  
  public static Collection<AbstractCodanProblemDetailsProvider> getProviders(String id)
  {
    readExtensions();
    Collection<AbstractCodanProblemDetailsProvider> providers = new ArrayList();
    Collection<?> collection1 = getCollection(id);
    Collection<?> collection2 = getCollection("*");
    providers.addAll(resolveProviders(collection1));
    providers.addAll(resolveProviders(collection2));
    return providers;
  }
  
  public static Collection<AbstractCodanProblemDetailsProvider> resolveProviders(Collection collection)
  {
    Collection res = new ArrayList(collection);
    for (Iterator iterator = res.iterator(); iterator.hasNext();)
    {
      Object object = iterator.next();
      if ((object instanceof IConfigurationElement))
      {
        collection.remove(object);
        AbstractCodanProblemDetailsProvider provider = resolveClass((IConfigurationElement)object);
        if (provider != null) {
          collection.add(provider);
        }
      }
    }
    return collection;
  }
  
  public static void addExtension(String id, AbstractCodanProblemDetailsProvider provider)
  {
    Collection collection = getCollection(id);
    collection.add(provider);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.views.ProblemDetailsExtensions
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.views;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;

class ProblemDetails$2
  implements ISelectionListener
{
  ProblemDetails$2(ProblemDetails paramProblemDetails) {}
  
  public void selectionChanged(IWorkbenchPart part, ISelection selection)
  {
    if (part.getSite().getId().equals("org.eclipse.ui.views.ProblemView")) {
      this$0.processSelection(selection);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.views.ProblemDetails.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.views;

import java.util.Collection;
import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;
import org.eclipse.cdt.codan.ui.CodanEditorUtility;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;

public class ProblemDetails
  extends ViewPart
{
  public static final String ID = "org.eclipse.cdt.codan.internal.ui.views.ProblemDetails";
  private Composite area;
  private Link message;
  private Link description;
  private GenericCodanProblemDetailsProvider genProvider = new GenericCodanProblemDetailsProvider();
  private AbstractCodanProblemDetailsProvider curProvider = genProvider;
  
  public void createPartControl(Composite parent)
  {
    area = new Composite(parent, 0);
    area.setLayout(new GridLayout());
    SelectionAdapter linkSelAdapter = new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        String link = text;
        if (link == null) {
          return;
        }
        if (link.startsWith("http"))
        {
          Program.launch(text);
          return;
        }
        if (link.startsWith("file:"))
        {
          try
          {
            CodanEditorUtility.openFileURL(link, curProvider.getMarker().getResource());
          }
          catch (PartInitException e1)
          {
            CodanUIActivator.log(e1);
          }
          catch (BadLocationException e1)
          {
            CodanUIActivator.log(e1);
          }
          return;
        }
        if (link.startsWith("help:")) {}
      }
    };
    message = new Link(area, 64);
    message.setLayoutData(new GridData(768));
    message.addSelectionListener(linkSelAdapter);
    description = new Link(area, 64);
    description.setLayoutData(new GridData(768));
    description.addSelectionListener(linkSelAdapter);
    ISelectionService ser = (ISelectionService)getSite().getService(ISelectionService.class);
    ser.addSelectionListener(new ISelectionListener()
    {
      public void selectionChanged(IWorkbenchPart part, ISelection selection)
      {
        if (part.getSite().getId().equals("org.eclipse.ui.views.ProblemView")) {
          processSelection(selection);
        }
      }
    });
    ISelection selection = ser.getSelection("org.eclipse.ui.views.ProblemView");
    processSelection(selection);
  }
  
  protected void processSelection(ISelection selection)
  {
    if ((selection == null) || (selection.isEmpty())) {
      return;
    }
    if ((selection instanceof IStructuredSelection))
    {
      Object firstElement = ((IStructuredSelection)selection).getFirstElement();
      IMarker marker = null;
      if ((firstElement instanceof IAdaptable)) {
        marker = (IMarker)((IAdaptable)firstElement).getAdapter(IMarker.class);
      } else if ((firstElement instanceof IMarker)) {
        marker = (IMarker)firstElement;
      }
      if (marker != null)
      {
        queryProviders(marker);
        area.layout();
      }
    }
  }
  
  private void queryProviders(IMarker marker)
  {
    String id = marker.getAttribute("id", "id");
    Collection<AbstractCodanProblemDetailsProvider> providers = ProblemDetailsExtensions.getProviders(id);
    for (AbstractCodanProblemDetailsProvider provider : providers) {
      synchronized (provider)
      {
        provider.setMarker(marker);
        if (provider.isApplicable(id))
        {
          applyProvider(provider);
          return;
        }
      }
    }
    genProvider.setMarker(marker);
    applyProvider(genProvider);
  }
  
  private void applyProvider(AbstractCodanProblemDetailsProvider provider)
  {
    curProvider = provider;
    setTextSafe(message, provider, provider.getStyledProblemMessage());
    setTextSafe(description, provider, provider.getStyledProblemDescription());
  }
  
  protected void setTextSafe(Link control, AbstractCodanProblemDetailsProvider provider, String text)
  {
    try
    {
      control.setText(text);
    }
    catch (Exception e)
    {
      control.setText("failed to set text: " + provider.getClass() + " " + e.getMessage());
    }
  }
  
  public void setFocus()
  {
    message.setFocus();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.views.ProblemDetails
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui.views;

import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider;

public class GenericCodanProblemDetailsProvider
  extends AbstractCodanProblemDetailsProvider
{
  public boolean isApplicable(String id)
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.views.GenericCodanProblemDetailsProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui;

import org.eclipse.ui.IMarkerResolution;

class CodanProblemMarkerResolutionGenerator$ConditionalResolution
{
  IMarkerResolution res;
  String messagePattern;
  
  public CodanProblemMarkerResolutionGenerator$ConditionalResolution(IMarkerResolution res2, String messagePattern2)
  {
    res = res2;
    messagePattern = messagePattern2;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.cdt.codan.internal.ui.CodanProblemMarkerResolutionGenerator.ConditionalResolution
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.cdt.codan.internal.ui;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.preferences.ScopedPreferenceStore;
import org.osgi.framework.BundleContext;

public class CodanUIActivator
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.cdt.codan.ui";
  private static CodanUIActivator plugin;
  private IPreferenceStore corePreferenceStore;
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
    plugin = this;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    plugin = null
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd