org.eclipse.ui.internal.ide.IDEWorkbenchPlugin Java Examples
The following examples show how to use
org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewUZProjectWizardPage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
protected boolean validatePage() { canFinish=false; getShell().setText(Messages.CREATEPROJECTWIZARD); IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); String projectFieldContents = getProjectNameFieldValue(); if (projectFieldContents.equals("")) { setErrorMessage(null); setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty); return false; } IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT); if (!nameStatus.isOK()) { setErrorMessage(nameStatus.getMessage()); return false; } IProject handle = getProjectHandle(); if (handle.exists()) { setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage); return false; } return dialogChanged(); }
Example #2
Source File: CopyFilesAndFoldersOperation.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * Build the collection of fileStores that map to fileNames. If any of them * cannot be found then match then return <code>null</code>. * * @param uris * @return IFileStore[] */ private IFileStore[] buildFileStores(URI[] uris) { IFileStore[] stores = new IFileStore[uris.length]; for (int i = 0; i < uris.length; i++) { IFileStore store; try { store = EFS.getStore(uris[i]); } catch (CoreException e) { IDEWorkbenchPlugin.log(e.getMessage(), e); reportFileInfoNotFound(uris[i].toString()); return null; } if (store == null) { reportFileInfoNotFound(uris[i].toString()); return null; } stores[i] = store; } return stores; }
Example #3
Source File: FileFolderSelectionDialog.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public IStatus validate(Object[] selection) { int nSelected = selection.length; String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH; if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) { return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, IDEResourceInfoUtils.EMPTY_STRING, null); } for (int i = 0; i < selection.length; i++) { Object curr = selection[i]; if (curr instanceof IFileStore) { IFileStore file = (IFileStore) curr; if (acceptFolders == false && file.fetchInfo().isDirectory()) { return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, IDEResourceInfoUtils.EMPTY_STRING, null); } } } return Status.OK_STATUS; }
Example #4
Source File: ImportProjectWizard.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor for ExternalProjectImportWizard. * * @param initialPath Default path for wizard to import * @since 3.5 */ public ImportProjectWizard(String initialPath) { super(); this.initialPath = initialPath; setWindowTitle(DataTransferMessages.DataTransfer_importTitle); setNeedsProgressMonitor(true); IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault() .getDialogSettings(); IDialogSettings wizardSettings = workbenchSettings .getSection(IMPORT_PROJECT_SECTION); if (wizardSettings == null) { wizardSettings = workbenchSettings .addNewSection(IMPORT_PROJECT_SECTION); } setDialogSettings(wizardSettings); }
Example #5
Source File: RenameResourceAction.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Return the new name to be given to the target resource. * * @return java.lang.String * @param resource * the resource to query status on */ protected String queryNewResourceName(final IResource resource) { final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); final IPath prefix = resource.getFullPath().removeLastSegments(1); final IInputValidator validator = string -> { if (resource.getName().equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; } final IStatus status = workspace.validateName(string, resource.getType()); if (!status.isOK()) { return status.getMessage(); } if (workspace.getRoot().exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; } return null; }; final InputDialog dialog = new InputDialog(WorkbenchHelper.getShell(), IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle, IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator); dialog.setBlockOnOpen(true); final int result = dialog.open(); if (result == Window.OK) { return dialog.getValue(); } return null; }
Example #6
Source File: ImportProjectWizard.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor for ExternalProjectImportWizard. * * @param initialPath Default path for wizard to import * @since 3.5 */ public ImportProjectWizard(String initialPath) { super(); this.initialPath = initialPath; setWindowTitle(DataTransferMessages.DataTransfer_importTitle); setNeedsProgressMonitor(true); IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault() .getDialogSettings(); IDialogSettings wizardSettings = workbenchSettings .getSection(IMPORT_PROJECT_SECTION); if (wizardSettings == null) { wizardSettings = workbenchSettings .addNewSection(IMPORT_PROJECT_SECTION); } setDialogSettings(wizardSettings); }
Example #7
Source File: GamaActionBarAdvisor.java From gama with GNU General Public License v3.0 | 6 votes |
/** * Creates the feature-dependent actions for the menu bar. */ private void makeFeatureDependentActions(final IWorkbenchWindow aWindow) { // final AboutInfo[] infos = null; final IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); // Optimization: avoid obtaining the about infos if the platform state is // unchanged from last time. See bug 75130 for details. final String stateKey = "platformState"; //$NON-NLS-1$ final String prevState = prefs.getString(stateKey); final String currentState = String.valueOf(Platform.getStateStamp()); final boolean sameState = currentState.equals(prevState); if ( !sameState ) { prefs.putValue(stateKey, currentState); } }
Example #8
Source File: FileFolderSelectionDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public IStatus validate(Object[] selection) { int nSelected = selection.length; String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH; if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) { return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, IDEResourceInfoUtils.EMPTY_STRING, null); } for (int i = 0; i < selection.length; i++) { Object curr = selection[i]; if (curr instanceof IFileStore) { IFileStore file = (IFileStore) curr; if (acceptFolders == false && file.fetchInfo().isDirectory()) { return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, IDEResourceInfoUtils.EMPTY_STRING, null); } } } return Status.OK_STATUS; }
Example #9
Source File: ApplicationWorkbenchAdvisor.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 声明所需要使用的图片; */ private void declareWorkbenchImages() { final String iconsPath = "$nl$/icons/full/"; //$NON-NLS-1$ final String pathElocaltool = iconsPath + "elcl16/"; // Enabled //$NON-NLS-1$ final String pathObject = iconsPath + "obj16/"; // Model object //$NON-NLS-1$ Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, pathObject + "prj_obj.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, pathObject + "cprj_obj.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OPEN_MARKER, pathElocaltool + "gotoobj_tsk.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_TASK_TSK, pathObject + "taskmrk_tsk.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_BKMRK_TSK, pathObject + "bkmrk_tsk.gif", true); //$NON-NLS-1$ }
Example #10
Source File: ApplicationWorkbenchAdvisor.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 声明所需要使用的图片; */ private void declareWorkbenchImages() { final String iconsPath = "$nl$/icons/full/"; //$NON-NLS-1$ final String pathElocaltool = iconsPath + "elcl16/"; // Enabled //$NON-NLS-1$ final String pathObject = iconsPath + "obj16/"; // Model object //$NON-NLS-1$ Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, pathObject + "prj_obj.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, pathObject + "cprj_obj.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OPEN_MARKER, pathElocaltool + "gotoobj_tsk.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_TASK_TSK, pathObject + "taskmrk_tsk.gif", true); //$NON-NLS-1$ declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_BKMRK_TSK, pathObject + "bkmrk_tsk.gif", true); //$NON-NLS-1$ }
Example #11
Source File: ApplicationWorkbenchWindowAdvisor.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 设置在拖动文件到导航视图时的模式为直接复制,见类 {@link CopyFilesAndFoldersOperation} 的方法 CopyFilesAndFoldersOperation * robert 09-26 */ private void setDragModle(){ IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore(); store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE, IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY); store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE, IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY); }
Example #12
Source File: ArchiveFileExportOperation2.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the status of the operation. If there were any errors, the result is a status object containing * individual status objects for each error. If there were no errors, the result is a status object with error code * <code>OK</code>. * @return the status */ public IStatus getStatus() { IStatus[] errors = new IStatus[errorTable.size()]; errorTable.toArray(errors); return new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.OK, errors, DataTransferMessages.FileSystemExportOperation_problemsExporting, null); }
Example #13
Source File: ImportProjectWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * The browse button has been selected. Select the location. */ protected void handleLocationArchiveButtonPressed() { FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET); dialog.setFilterExtensions(FILE_IMPORT_MASK); dialog .setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle); String fileName = archivePathField.getText().trim(); if (fileName.length() == 0) { fileName = previouslyBrowsedArchive; } if (fileName.length() == 0) { dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace() .getRoot().getLocation().toOSString()); } else { File path = new File(fileName).getParentFile(); if (path != null && path.exists()) { dialog.setFilterPath(path.toString()); } } String selectedArchive = dialog.open(); if (selectedArchive != null) { previouslyBrowsedArchive = selectedArchive; archivePathField.setText(previouslyBrowsedArchive); updateProjectsList(selectedArchive); } }
Example #14
Source File: ImportProjectWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Retrieve all the projects in the current workspace. * * @return IProject[] array of IProject in the current workspace */ private IProject[] getProjectsInWorkspace() { if (wsProjects == null) { wsProjects = IDEWorkbenchPlugin.getPluginWorkspace().getRoot() .getProjects(); } return wsProjects; }
Example #15
Source File: RenameResourceAndCloseEditorAction.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * Return the new name to be given to the target resource. * * @return java.lang.String * @param resource * the resource to query status on */ protected String queryNewResourceName(final IResource resource) { final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); final IPath prefix = resource.getFullPath().removeLastSegments(1); IInputValidator validator = new IInputValidator() { public String isValid(String string) { if (resource.getName().equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; } IStatus status = workspace.validateName(string, resource .getType()); if (!status.isOK()) { return status.getMessage(); } if (workspace.getRoot().exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; } return null; } }; InputDialog dialog = new InputDialog(shellProvider.getShell(), IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle, IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator); dialog.setBlockOnOpen(true); int result = dialog.open(); if (result == Window.OK) return dialog.getValue(); return null; }
Example #16
Source File: JobCamelScriptsExportWizard.java From tesb-studio-se with Apache License 2.0 | 5 votes |
public JobCamelScriptsExportWizard() { setWindowTitle(Messages.getString("JobScriptsExportWizard.buildRounte")); //$NON-NLS-1$ setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportzip_wiz.png"));//$NON-NLS-1$ setNeedsProgressMonitor(true); IDialogSettings workbenchSettings = CamelDesignerPlugin.getDefault().getDialogSettings(); IDialogSettings section = workbenchSettings.getSection("JobCamelScriptsExportWizard"); //$NON-NLS-1$ if (section == null) { section = workbenchSettings.addNewSection("JobCamelScriptsExportWizard"); //$NON-NLS-1$ } setDialogSettings(section); }
Example #17
Source File: ExtensibleWizardNewProjectCreationPage.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Returns whether this page's controls currently all contain valid values. * * @return <code>true</code> if all controls are valid, and <code>false</code> if at least one is invalid */ protected boolean validatePage() { IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); // CHANGED: use getProjectName to allow subclasses to control what concrete project name value is validated String projectFieldContents = getProjectName(); if (projectFieldContents.equals("")) { //$NON-NLS-1$ setErrorMessage(null); setMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectNameEmpty); return false; } IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT); if (!nameStatus.isOK()) { setErrorMessage(nameStatus.getMessage()); return false; } IProject handle = getProjectHandle(); if (handle.exists()) { setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage); return false; } // CHANGED: allow getProjectHandle to control the IProject instance used here locationArea.setExistingProject(handle); String validLocationMessage = locationArea.checkValidLocation(); if (validLocationMessage != null) { // there is no destination location given setErrorMessage(validLocationMessage); return false; } setErrorMessage(null); setMessage(null); return true; }
Example #18
Source File: ApplicationWorkbenchWindowAdvisor.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 设置在拖动文件到导航视图时的模式为直接复制,见类 {@link CopyFilesAndFoldersOperation} 的方法 CopyFilesAndFoldersOperation * robert 09-26 */ private void setDragModle(){ IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore(); store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE, IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY); store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE, IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY); }
Example #19
Source File: ArchiveFileExportOperation2.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the status of the operation. If there were any errors, the result is a status object containing * individual status objects for each error. If there were no errors, the result is a status object with error code * <code>OK</code>. * @return the status */ public IStatus getStatus() { IStatus[] errors = new IStatus[errorTable.size()]; errorTable.toArray(errors); return new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.OK, errors, DataTransferMessages.FileSystemExportOperation_problemsExporting, null); }
Example #20
Source File: ImportProjectWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * The browse button has been selected. Select the location. */ protected void handleLocationArchiveButtonPressed() { FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET); dialog.setFilterExtensions(FILE_IMPORT_MASK); dialog .setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle); String fileName = archivePathField.getText().trim(); if (fileName.length() == 0) { fileName = previouslyBrowsedArchive; } if (fileName.length() == 0) { dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace() .getRoot().getLocation().toOSString()); } else { File path = new File(fileName).getParentFile(); if (path != null && path.exists()) { dialog.setFilterPath(path.toString()); } } String selectedArchive = dialog.open(); if (selectedArchive != null) { previouslyBrowsedArchive = selectedArchive; archivePathField.setText(previouslyBrowsedArchive); updateProjectsList(selectedArchive); } }
Example #21
Source File: ImportProjectWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Retrieve all the projects in the current workspace. * * @return IProject[] array of IProject in the current workspace */ private IProject[] getProjectsInWorkspace() { if (wsProjects == null) { wsProjects = IDEWorkbenchPlugin.getPluginWorkspace().getRoot() .getProjects(); } return wsProjects; }
Example #22
Source File: RenameResourceAndCloseEditorAction.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * Return the new name to be given to the target resource. * * @return java.lang.String * @param resource * the resource to query status on */ protected String queryNewResourceName(final IResource resource) { final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); final IPath prefix = resource.getFullPath().removeLastSegments(1); IInputValidator validator = new IInputValidator() { public String isValid(String string) { if (resource.getName().equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; } IStatus status = workspace.validateName(string, resource .getType()); if (!status.isOK()) { return status.getMessage(); } if (workspace.getRoot().exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; } return null; } }; InputDialog dialog = new InputDialog(shellProvider.getShell(), IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle, IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator); dialog.setBlockOnOpen(true); int result = dialog.open(); if (result == Window.OK) return dialog.getValue(); return null; }
Example #23
Source File: CopyFilesAndFoldersOperation.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private void display(InvocationTargetException e) { // CoreExceptions are collected above, but unexpected runtime // exceptions and errors may still occur. IDEWorkbenchPlugin.getDefault().getLog() .log(StatusUtil.newStatus(IStatus.ERROR, MessageFormat.format("Exception in {0}.performCopy(): {1}", //$NON-NLS-1$ new Object[] { getClass().getName(), e.getTargetException() }), null)); displayError(NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_internalError, e.getTargetException() .getMessage())); }
Example #24
Source File: CopyFilesAndFoldersOperation.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Checks whether the destination is valid for copying the source file * stores. * <p> * Note this method is for internal use only. It is not API. * </p> * <p> * TODO Bug 117804. This method has been renamed to avoid a bug in the * Eclipse compiler with regards to visibility and type resolution when * linking. * </p> * * @param destination * the destination container * @param sourceStores * the source IFileStore * @return an error message, or <code>null</code> if the path is valid */ private String validateImportDestinationInternal(IContainer destination, IFileStore[] sourceStores) { if (!isAccessible(destination)) { return IDEWorkbenchMessages.CopyFilesAndFoldersOperation_destinationAccessError; } IFileStore destinationStore; try { destinationStore = EFS.getStore(destination.getLocationURI()); } catch (CoreException exception) { IDEWorkbenchPlugin.log(exception.getLocalizedMessage(), exception); return NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_internalError, exception.getLocalizedMessage()); } for (int i = 0; i < sourceStores.length; i++) { IFileStore sourceStore = sourceStores[i]; IFileStore sourceParentStore = sourceStore.getParent(); if (sourceStore != null) { if (destinationStore.equals(sourceStore) || (sourceParentStore != null && destinationStore.equals(sourceParentStore))) { return NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_importSameSourceAndDest, sourceStore.getName()); } // work around bug 16202. replacement for // sourcePath.isPrefixOf(destinationPath) IFileStore destinationParent = destinationStore.getParent(); if (sourceStore.isParentOf(destinationParent)) { return IDEWorkbenchMessages.CopyFilesAndFoldersOperation_destinationDescendentError; } } } return null; }
Example #25
Source File: PyRenameResourceAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Return the new name to be given to the target resource. * * @return java.lang.String * @param resource the resource to query status on * * Fix from platform: was not checking return from dialog.open */ @Override protected String queryNewResourceName(final IResource resource) { final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); final IPath prefix = resource.getFullPath().removeLastSegments(1); IInputValidator validator = new IInputValidator() { @Override public String isValid(String string) { if (resource.getName().equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; } IStatus status = workspace.validateName(string, resource.getType()); if (!status.isOK()) { return status.getMessage(); } if (workspace.getRoot().exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; } return null; } }; InputDialog dialog = new InputDialog(shell, IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle, IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator); dialog.setBlockOnOpen(true); if (dialog.open() == Window.OK) { return dialog.getValue(); } else { return null; } }
Example #26
Source File: ImportProjectWizardPage.java From gama with GNU General Public License v3.0 | 5 votes |
/** * The browse button has been selected. Select the location. */ protected void handleLocationDirectoryButtonPressed() { final DirectoryDialog dialog = new DirectoryDialog(directoryPathField.getShell(), SWT.SHEET); dialog.setMessage(DataTransferMessages.WizardProjectsImportPage_SelectDialogTitle); String dirName = directoryPathField.getText().trim(); if (dirName.length() == 0) { dirName = previouslyBrowsedDirectory; } if (dirName.length() == 0) { dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getLocation().toOSString()); } else { final File path = new File(dirName); if (path.exists()) { dialog.setFilterPath(new Path(dirName).toOSString()); } } final String selectedDirectory = dialog.open(); if (selectedDirectory != null) { previouslyBrowsedDirectory = selectedDirectory; directoryPathField.setText(previouslyBrowsedDirectory); updateProjectsList(selectedDirectory); } }
Example #27
Source File: AbapGitStagingService.java From ADT_Frontend with MIT License | 5 votes |
private String getEditorId(String fileName) { if (fileName.endsWith("xml")) { //$NON-NLS-1$ //if file type is .xml, return the associated XML editor IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry(); IEditorDescriptor desc = editorReg.getDefaultEditor(fileName, Platform.getContentTypeManager().findContentTypeFor(fileName)); if (desc != null) { return desc.getId(); } } //use eclipse default text editor for all other files return IDEWorkbenchPlugin.DEFAULT_TEXT_EDITOR_ID; }
Example #28
Source File: AbstractNewProjectWizard.java From typescript.java with MIT License | 5 votes |
/** * Prompts the user for whether to switch perspectives. * * @param window * The workbench window in which to switch perspectives; must not * be <code>null</code> * @param finalPersp * The perspective to switch to; must not be <code>null</code>. * * @return <code>true</code> if it's OK to switch, <code>false</code> * otherwise */ private static boolean confirmPerspectiveSwitch(IWorkbenchWindow window, IPerspectiveDescriptor finalPersp) { IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); String pspm = store.getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE); if (!IDEInternalPreferences.PSPM_PROMPT.equals(pspm)) { // Return whether or not we should always switch return IDEInternalPreferences.PSPM_ALWAYS.equals(pspm); } String desc = finalPersp.getDescription(); String message; if (desc == null || desc.length() == 0) message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessage, finalPersp.getLabel()); else message = NLS.bind(ResourceMessages.NewProject_perspSwitchMessageWithDesc, new String[] { finalPersp.getLabel(), desc }); MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(window.getShell(), ResourceMessages.NewProject_perspSwitchTitle, message, null /* use the default message for the toggle */, false /* toggle is initially unchecked */, store, IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE); int result = dialog.getReturnCode(); // If we are not going to prompt anymore propogate the choice. if (dialog.getToggleState()) { String preferenceValue; if (result == IDialogConstants.YES_ID) { // Doesn't matter if it is replace or new window // as we are going to use the open perspective setting preferenceValue = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE; } else { preferenceValue = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE; } // update PROJECT_OPEN_NEW_PERSPECTIVE to correspond PrefUtil.getAPIPreferenceStore().setValue(IDE.Preferences.PROJECT_OPEN_NEW_PERSPECTIVE, preferenceValue); } return result == IDialogConstants.YES_ID; }
Example #29
Source File: ZipLeveledStructureProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public InputStream getContents(Object element) { try { return zipFile.getInputStream((ZipArchiveEntry) element); } catch (IOException e) { IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e); return null; } }
Example #30
Source File: ZipLeveledStructureProvider.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public boolean closeArchive(){ try { getZipFile().close(); } catch (IOException e) { IDEWorkbenchPlugin.log(DataTransferMessages.ZipImport_couldNotClose + getZipFile(), e); return false; } return true; }