Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
Initial port of JDT's ContentAssistProcessor and related classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-medeiros committed Mar 31, 2015
1 parent 6273e25 commit 675b705
Show file tree
Hide file tree
Showing 14 changed files with 1,699 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.IAutoEditStrategy;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.contentassist.IContentAssistant;
import org.eclipse.jface.text.presentation.IPresentationReconciler;
import org.eclipse.jface.text.presentation.PresentationReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
Expand Down Expand Up @@ -216,4 +217,9 @@ public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentTyp

protected abstract String getToggleCommentPrefix();

@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
return super.getContentAssistant(sourceViewer);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.corext.util;

import java.text.MessageFormat;


/**
* Helper class to format message strings.
*
* @since 3.1
* BM: we modified this to use Java's MessageFormat
*/
public class Messages {

public static String format(String message, Object object) {
return MessageFormat.format(message, new Object[] { object});
}

public static String format(String message, Object[] objects) {
return MessageFormat.format(message, objects);
}

public static String format_2(String message, Object... objects) {
return MessageFormat.format(message, objects);
}


private Messages() {
// Not for instantiation
}
}
12 changes: 12 additions & 0 deletions plugin_ide.ui/src-lang/org/eclipse/jdt/internal/ui/JavaPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.eclipse.jdt.internal.ui;

import melnorme.lang.ide.ui.LangUIPlugin;


public abstract class JavaPlugin extends LangUIPlugin {

public static LangUIPlugin getDefault() {
return LangUIPlugin.getInstance();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*******************************************************************************
* Copyright (c) 2015, 2015 Bruno Medeiros and other Contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Bruno Medeiros - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui;

public interface JavaUIMessages {

String OptionalMessageDialog_dontShowAgain =
"Do not show this &message again";
String JavaEditor_codeassist_noCompletions =
"No completions available.";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.internal.ui.text.java;

import org.eclipse.jface.text.contentassist.ICompletionProposal;

import org.eclipse.jdt.ui.text.java.AbstractProposalSorter;
import org.eclipse.jdt.ui.text.java.CompletionProposalComparator;

/**
* A alphabetic proposal based sorter.
*
* @since 3.2
*/
public final class AlphabeticSorter extends AbstractProposalSorter {

protected final CompletionProposalComparator fComparator= new CompletionProposalComparator(true);

public AlphabeticSorter() {
}

@Override
public int compare(ICompletionProposal p1, ICompletionProposal p2) {
return fComparator.compare(p1, p2);
}

}
Loading

0 comments on commit 675b705

Please sign in to comment.