Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkhorne2004-02-04 16:58:38 +0000
committerkhorne2004-02-04 16:58:38 +0000
commite53c1275c3ec15932257b054de4218f428bf38b3 (patch)
treedf6ef828b52dc8295c64c258276ee5398c3f9f93
parentd1e2a625d7c67efbbe7f3770267cc5db7bec8d01 (diff)
downloadeclipse.platform.text-e53c1275c3ec15932257b054de4218f428bf38b3.tar.gz
eclipse.platform.text-e53c1275c3ec15932257b054de4218f428bf38b3.tar.xz
eclipse.platform.text-e53c1275c3ec15932257b054de4218f428bf38b3.zip
Patch commited on behalf of VIpre_merge_new_look_20040213
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java1
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java95
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java2
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java32
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java2
5 files changed, 45 insertions, 87 deletions
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
index ad2f816e6..188f9f3c0 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractRulerActionDelegate.java
@@ -102,6 +102,7 @@ public abstract class AbstractRulerActionDelegate implements IEditorActionDelega
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
+ update();
}
/**
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
index 0ced2bff9..c5ebf4606 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextEditor.java
@@ -15,8 +15,6 @@ package org.eclipse.ui.texteditor;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -26,9 +24,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.ILog;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginPrerequisite;
-import org.eclipse.core.runtime.IPluginRegistry;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -462,74 +457,6 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
/**
- * Compare configuration elements according to the prerequisite relation
- * of their defining plug-ins.
- *
- * @since 2.0
- */
- static class ConfigurationElementComparator implements Comparator {
-
- /*
- * @see Comparator#compare(java.lang.Object, java.lang.Object)
- * @since 2.0
- */
- public int compare(Object object0, Object object1) {
-
- IConfigurationElement element0= (IConfigurationElement)object0;
- IConfigurationElement element1= (IConfigurationElement)object1;
-
- if (dependsOn(element0, element1))
- return -1;
-
- if (dependsOn(element1, element0))
- return +1;
-
- return 0;
- }
-
- /**
- * Returns whether one configuration element depends on the other element.
- * This is done by checking the dependency chain of the defining plug-ins.
- *
- * @param element0 the first element
- * @param element1 the second element
- * @return <code>true</code> if <code>element0</code> depends on <code>element1</code>.
- * @since 2.0
- */
- private static boolean dependsOn(IConfigurationElement element0, IConfigurationElement element1) {
- IPluginDescriptor descriptor0= element0.getDeclaringExtension().getDeclaringPluginDescriptor();
- IPluginDescriptor descriptor1= element1.getDeclaringExtension().getDeclaringPluginDescriptor();
-
- return dependsOn(descriptor0, descriptor1);
- }
-
- /**
- * Returns whether one plug-in depends on the other plugin.
- *
- * @param descriptor0 descriptor of the first plug-in
- * @param descriptor1 descriptor of the second plug-in
- * @return <code>true</code> if <code>descriptor0</code> depends on <code>descriptor1</code>.
- * @since 2.0
- */
- private static boolean dependsOn(IPluginDescriptor descriptor0, IPluginDescriptor descriptor1) {
-
- IPluginRegistry registry= Platform.getPluginRegistry();
- IPluginPrerequisite[] prerequisites= descriptor0.getPluginPrerequisites();
-
- for (int i= 0; i < prerequisites.length; i++) {
- IPluginPrerequisite prerequisite= prerequisites[i];
- String id= prerequisite.getUniqueIdentifier();
- IPluginDescriptor descriptor= registry.getPluginDescriptor(id);
-
- if (descriptor != null && (descriptor.equals(descriptor1) || dependsOn(descriptor, descriptor1)))
- return true;
- }
-
- return false;
- }
- }
-
- /**
* Internal property change listener for handling changes in the editor's preferences.
*/
class PropertyChangeListener implements IPropertyChangeListener {
@@ -3366,10 +3293,24 @@ public abstract class AbstractTextEditor extends EditorPart implements ITextEdit
}
}
}
- Collections.sort(actions, new ConfigurationElementComparator());
-
- if (actions.size() != 0) {
- IConfigurationElement element= (IConfigurationElement) actions.get(0);
+ int actionSize= actions.size();
+ if (actionSize > 0) {
+ IConfigurationElement element;
+ if (actionSize > 1) {
+ IConfigurationElement[] actionArray= (IConfigurationElement[])actions.toArray(new IConfigurationElement[actionSize]);
+ ConfigurationElementSorter sorter= new ConfigurationElementSorter() {
+ /**
+ * {@inheritDoc}
+ */
+ public IConfigurationElement getConfigurationElement(Object object) {
+ return (IConfigurationElement)object;
+ }
+ };
+ sorter.sort(actionArray);
+ element= actionArray[0];
+ } else
+ element= (IConfigurationElement)actions.get(0);
+
String defId = element.getAttribute(ActionDescriptor.ATT_DEFINITION_ID);
return new EditorPluginAction(element, "class", this, defId, IAction.AS_UNSPECIFIED); //$NON-NLS-1$
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
index a7f261164..ead14f376 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/DefaultRangeIndicator.java
@@ -49,8 +49,6 @@ public class DefaultRangeIndicator extends Annotation implements IAnnotationPres
* Creates a new range indicator.
*/
public DefaultRangeIndicator() {
- super();
- setLayer(0);
}
/*
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
index 3434acdd4..b30062252 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/FindReplaceDialog.java
@@ -48,7 +48,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.JFaceColors;
-
import org.eclipse.jface.text.DefaultInformationControl;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IFindReplaceTarget;
@@ -59,6 +58,7 @@ import org.eclipse.jface.text.IInformationControlCreator;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.contentassist.ComboContentAssistSubjectAdapter;
import org.eclipse.jface.text.contentassist.ContentAssistant;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.contentassist.IContentAssistant;
@@ -226,13 +226,25 @@ class FindReplaceDialog extends Dialog {
*/
private boolean fUseSelectedLines;
/**
- * The content assitant for the find combo.
+ * The content assistant subject adapter for the find combo.
+ *
+ * @since 3.0
+ */
+ private ComboContentAssistSubjectAdapter fFindFieldContentAssistAdapter;
+ /**
+ * The content assistant subject adapter for the replace combo.
+ *
+ * @since 3.0
+ */
+ private ComboContentAssistSubjectAdapter fReplaceFieldContentAssistAdapter;
+ /**
+ * The content assistant for the find combo.
*
* @since 3.0
*/
private ContentAssistant fFindFieldContentAssistant;
/**
- * The content assitant for the replace combo.
+ * The content assistant for the replace combo.
*
* @since 3.0
*/
@@ -454,8 +466,10 @@ class FindReplaceDialog extends Dialog {
fProposalPopupBackgroundColor= new Color(getShell().getDisplay(), new RGB(254, 241, 233));
fProposalPopupForegroundColor= new Color(getShell().getDisplay(), new RGB(0, 0, 0));
- fFindFieldContentAssistant= createContentAssistant(fFindField);
- fReplaceFieldContentAssistant= createContentAssistant(fReplaceField);
+ fFindFieldContentAssistAdapter= new ComboContentAssistSubjectAdapter(fFindField);
+ fFindFieldContentAssistant= createContentAssistant(fFindField, fFindFieldContentAssistAdapter);
+ fReplaceFieldContentAssistAdapter= new ComboContentAssistSubjectAdapter(fReplaceField);
+ fReplaceFieldContentAssistant= createContentAssistant(fReplaceField, fReplaceFieldContentAssistAdapter);
return panel;
}
@@ -722,7 +736,9 @@ class FindReplaceDialog extends Dialog {
updateButtonState();
storeSettings();
fFindFieldContentAssistant.enableAutoActivation(newState);
+ fFindFieldContentAssistAdapter.enableContentAssistCue(newState);
fReplaceFieldContentAssistant.enableAutoActivation(newState);
+ fReplaceFieldContentAssistAdapter.enableContentAssistCue(newState);
}
});
fWholeWordCheckBox.setEnabled(!isRegExSearchAvailableAndChecked());
@@ -1604,7 +1620,9 @@ class FindReplaceDialog extends Dialog {
}
fFindFieldContentAssistant.enableAutoActivation(isRegExSearchAvailableAndChecked());
+ fFindFieldContentAssistAdapter.enableContentAssistCue(isRegExSearchAvailableAndChecked());
fReplaceFieldContentAssistant.enableAutoActivation(isRegExSearchAvailableAndChecked());
+ fReplaceFieldContentAssistAdapter.enableContentAssistCue(isRegExSearchAvailableAndChecked());
}
/**
@@ -1713,7 +1731,7 @@ class FindReplaceDialog extends Dialog {
// ------------- content assistant -----------------
- private ContentAssistant createContentAssistant(final Combo combo) {
+ private ContentAssistant createContentAssistant(final Combo combo, ComboContentAssistSubjectAdapter adapter) {
final ContentAssistant contentAssistant= new ContentAssistant();
IContentAssistProcessor processor= new RegExContentAssistProcessor();
@@ -1763,7 +1781,7 @@ class FindReplaceDialog extends Dialog {
}
}});
- contentAssistant.install(new ComboContentAssistSubjectAdapter(combo));
+ contentAssistant.install(adapter);
return contentAssistant;
}
}
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java
index 6ac3c3a48..8f86e7d4f 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/ITextEditorExtension2.java
@@ -31,7 +31,7 @@ public interface ITextEditorExtension2 {
* value.
*
* @return <code>true</code> if the editor input is modifiable
- * */
+ */
boolean isEditorInputModifiable();
/**

Back to the top