1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-03 14:25:37 +02:00

[174479] Move remote search page to package org.eclipse.rse.internal.files.ui.search.

This commit is contained in:
Kushal Munir 2007-02-16 18:22:38 +00:00
parent 484a619cbf
commit 3a57443741
12 changed files with 1717 additions and 17 deletions

View file

@ -26,9 +26,9 @@ Export-Package: org.eclipse.rse.files.ui,
org.eclipse.rse.files.ui.dialogs,
org.eclipse.rse.files.ui.propertypages,
org.eclipse.rse.files.ui.resources,
org.eclipse.rse.files.ui.search,
org.eclipse.rse.files.ui.view,
org.eclipse.rse.files.ui.widgets,
org.eclipse.rse.files.ui.wizards
org.eclipse.rse.files.ui.wizards,
org.eclipse.rse.internal.files.ui.search;x-internal:=true
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: J2SE-1.4

View file

@ -24,10 +24,8 @@ PreferencePage.UniversalFiles = Files
PreferencePage.Cache = File Cache
RemotePropertyPage.File.Info = Info
PropertyPage.EnvVariables = Environment Variables
PropertyPage.ServerLauncherSettings = Server Launcher Settings
PropertyPage.ServerConnectionSecurity = Server Connection Security
PropertyPage.Service = Service
# View Filters
@ -47,4 +45,4 @@ VirtualObjectDecorator.label=Virtual Object Decorator
Search.Page = Remote Search
searchMenu.label = Se&arch
Remote.Search = &Remote...
Remote.Search.tooltip = Opens Remote Search dialog page for text and file searching on remote systems
Remote.Search.tooltip = Opens Remote Search dialog page for text and file searching on remote systems

View file

@ -171,9 +171,9 @@ Contributors:
label="%Search.Page"
enabled="true"
icon="icons/full/obj16/system_search.gif"
class="org.eclipse.rse.files.ui.search.SystemSearchPage"
class="org.eclipse.rse.internal.files.ui.search.SystemSearchPage"
sizeHint="250,160"
id="org.eclipse.rse.files.ui.search.searchPage">
id="org.eclipse.rse.internal.files.ui.search.searchPage">
</page>
</extension>
@ -202,7 +202,7 @@ Contributors:
tooltip="%Remote.Search.tooltip"
helpContextId="org.eclipse.rse.core.rsac0000"
icon="icons/full/obj16/system_search.gif"
class="org.eclipse.rse.files.ui.search.SystemOpenSearchPageAction"
class="org.eclipse.rse.internal.files.ui.search.SystemOpenSearchPageAction"
menubarPath="org.eclipse.search.menu/dialogGroup"
id="org.eclipse.rse.core.search.searchAction">
</action>

View file

@ -17,7 +17,7 @@
package org.eclipse.rse.files.ui.actions;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.files.ui.search.SystemSearchPage;
import org.eclipse.rse.internal.files.ui.search.SystemSearchPage;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemResources;

View file

@ -0,0 +1,62 @@
/********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation. 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
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.files.ui.search;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class SystemOpenSearchPageAction implements IWorkbenchWindowActionDelegate {
private IWorkbenchWindow window;
/**
* Constructor for open remote search page action.
*/
public SystemOpenSearchPageAction() {
super();
}
/**
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
public void dispose() {
}
/**
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
*/
public void init(IWorkbenchWindow window) {
this.window = window;
}
/**
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
NewSearchUI.openSearchDialog(window, SystemSearchPage.SYSTEM_SEARCH_PAGE_ID);
}
/**
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
}
}

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2002, 2007 IBM Corporation. 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
@ -13,7 +13,7 @@
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.files.ui.internal.search;
package org.eclipse.rse.internal.files.ui.search;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.rse.core.model.IHost;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. 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
@ -7,7 +7,7 @@
* Contributors:
* Kushal Munir (IBM) - initial API and implementation.
********************************************************************************/
package org.eclipse.rse.files.ui.internal.search;
package org.eclipse.rse.internal.files.ui.search;
import org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog;
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. 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
@ -7,7 +7,7 @@
* Contributors:
* Kushal Munir (IBM) - initial API and implementation.
********************************************************************************/
package org.eclipse.rse.files.ui.internal.search;
package org.eclipse.rse.internal.files.ui.search;
import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm;
import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl;

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2006 IBM Corporation. All rights reserved.
* Copyright (c) 2006, 2007 IBM Corporation. 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
@ -8,7 +8,7 @@
* Kushal Munir (IBM) - initial API and implementation.
********************************************************************************/
package org.eclipse.rse.files.ui.internal.search;
package org.eclipse.rse.internal.files.ui.search;
import java.util.List;
import java.util.Vector;

View file

@ -0,0 +1,47 @@
/********************************************************************************
* Copyright (c) 2006, 2007 IBM Corporation. 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
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.files.ui.search;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.rse.files.ui.actions.SystemSelectFileTypesAction;
import org.eclipse.swt.widgets.Shell;
/**
* Action to select file types for the search dialog.
*/
public class SystemSearchSelectFileTypesAction
extends SystemSelectFileTypesAction {
/**
* Creates the action.
* @param shell
*/
public SystemSearchSelectFileTypesAction(Shell shell) {
super(shell);
}
/**
* @see org.eclipse.rse.ui.actions.SystemBaseDialogAction#createDialog(org.eclipse.swt.widgets.Shell)
*/
public Dialog createDialog(Shell parent) {
SystemSearchSelectFileTypesDialog dialog = new SystemSearchSelectFileTypesDialog(getShell(), types);
return dialog;
}
}

View file

@ -0,0 +1,132 @@
/********************************************************************************
* Copyright (c) 2003, 2006, 2007 IBM Corporation. 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
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight, Kushal Munir,
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
********************************************************************************/
package org.eclipse.rse.internal.files.ui.search;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IFileEditorMapping;
import org.eclipse.ui.PlatformUI;
/**
* File types selection dialog for the search page.
*/
public class SystemSearchSelectFileTypesDialog extends SystemSelectFileTypesDialog {
/**
* Creates the dialog.
* @param shell the shell.
* @param currentTypes types to preselect.
*/
public SystemSearchSelectFileTypesDialog(Shell shell, Collection currentTypes) {
super(shell, currentTypes);
}
/**
* @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog#checkInitialSelections()
*/
protected void checkInitialSelections() {
IFileEditorMapping editorMappings[] = PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
ArrayList selectedMappings = new ArrayList();
// go through all editor mappings, and check of those that are in the initial selections
for (int i = 0; i < editorMappings.length; i++) {
IFileEditorMapping mapping = editorMappings[i];
if (initialSelections.contains(mapping.getExtension())) {
listViewer.setChecked(mapping, true);
selectedMappings.add(mapping.getExtension());
}
}
// now find those entries in the initial selections that are not in editor mappings
// add these entries to the user defined list
Iterator initialIterator = initialSelections.iterator();
StringBuffer entries = new StringBuffer();
boolean first = true;
while(initialIterator.hasNext()) {
String nextExtension = (String)initialIterator.next();
if(!selectedMappings.contains(nextExtension)) {
if (!first) {
// if not the first entry, add a comma and a space
entries.append(TYPE_DELIMITER);
entries.append(" "); //$NON-NLS-1$
}
else {
first = false;
}
entries.append(nextExtension);
}
}
userDefinedText.setText(entries.toString());
}
/**
* @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog#addUserDefinedEntries(java.util.List)
*/
protected void addUserDefinedEntries(List result) {
StringTokenizer tokenizer = new StringTokenizer(userDefinedText.getText(), TYPE_DELIMITER);
while (tokenizer.hasMoreTokens()) {
String currentExtension = tokenizer.nextToken().trim();
if (!currentExtension.equals("")) { //$NON-NLS-1$
result.add(currentExtension);
}
}
}
/**
* @see org.eclipse.rse.ui.dialogs.SystemPromptDialog#processOK()
*/
protected boolean processOK() {
IFileEditorMapping[] children = getInput();
List list = new ArrayList();
// build a list of selected children
for (int i = 0; i < children.length; ++i) {
IFileEditorMapping element = children[i];
if (listViewer.getChecked(element)) {
list.add(element.getLabel());
}
}
addUserDefinedEntries(list);
setResult(list);
return true;
}
/**
* @see org.eclipse.rse.ui.dialogs.SystemSelectFileTypesDialog#validateFileType(java.lang.String)
*/
protected boolean validateFileType(String filename) {
return true;
}
}