diff options
| author | Pierre-Charles David | 2015-09-09 09:30:08 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2015-09-18 13:21:02 +0000 |
| commit | 34738eaa91c0c09cef7671a7c1866ecdd9b75ed4 (patch) | |
| tree | 1e595fbbffe412d6e022c2d53359c3767fd26ddb | |
| parent | b95959ea4433fd6c5c99025476840bbb6f74d44d (diff) | |
| download | org.eclipse.sirius-34738eaa91c0c09cef7671a7c1866ecdd9b75ed4.tar.gz org.eclipse.sirius-34738eaa91c0c09cef7671a7c1866ecdd9b75ed4.tar.xz org.eclipse.sirius-34738eaa91c0c09cef7671a7c1866ecdd9b75ed4.zip | |
[472057] Externalize translatable messages from org.eclipse.sirius.ui
Bug: 472057
Change-Id: Iaebfb65d1d0b9259fc1288312e1ed16299fe3b95
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
109 files changed, 3013 insertions, 2466 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index 4994006108..e33488923c 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -322,6 +322,9 @@ <li> <code>org.eclipse.sirius.tree.ui</code> </li> + <li> + <code>org.eclipse.sirius.ui</code> + </li> </ul> </li> </ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 0eeeb3b7e3..24bf3dba68 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -79,6 +79,7 @@ Additional non-breaking changes: ** @org.eclipse.sirius.table.ui@ ** @org.eclipse.sirius.tree@ ** @org.eclipse.sirius.tree.ui@ +** @org.eclipse.sirius.ui@ h4. Changes in @org.eclipse.sirius.common@ diff --git a/plugins/org.eclipse.sirius.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.sirius.ui/.settings/org.eclipse.jdt.core.prefs index fc8c7f3ddc..39e1d0d4d4 100644 --- a/plugins/org.eclipse.sirius.ui/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.sirius.ui/.settings/org.eclipse.jdt.core.prefs @@ -32,7 +32,7 @@ org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore diff --git a/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF index cbcac0c5c7..9517f25018 100644 --- a/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF @@ -116,7 +116,7 @@ Require-Bundle: com.google.guava;bundle-version="[11.0.2,16.0)", Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy -Import-Package: org.eclipse.sirius.ext.base;version="2.0.0", +Import-Package: org.eclipse.sirius.ext.base;version="2.1.0", org.eclipse.sirius.ext.base.relations;version="2.0.0", org.eclipse.sirius.ext.emf.ui, org.eclipse.sirius.ext.emf.ui.properties, diff --git a/plugins/org.eclipse.sirius.ui/plugin.properties b/plugins/org.eclipse.sirius.ui/plugin.properties index b3678d90b6..78df91e5a2 100644 --- a/plugins/org.eclipse.sirius.ui/plugin.properties +++ b/plugins/org.eclipse.sirius.ui/plugin.properties @@ -1,5 +1,5 @@ # ==================================================================== -# Copyright (c) 2007, 2014 THALES GLOBAL SERVICES +# Copyright (c) 2007, 2014, 2015 THALES GLOBAL SERVICES 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 @@ -12,6 +12,334 @@ pluginName = Sirius UI providerName = Eclipse Modeling Project +AbstractCompositeEObjectPropertySource_missingEObject = eObject is null +AbstractCompositeEObjectPropertySource_missingId = id is null +AbstractCreateRepresentationFromRepresentationCreationDescription_creationError_message = An error occured when trying to create the representation.\nPlease check the representation specification. +AbstractCreateRepresentationFromRepresentationCreationDescription_creationError_title = Error creating the representation +AbstractCreateRepresentationFromRepresentationCreationDescription_defaultName = new {0} +AbstractDTreeEditor_eclipseWindowTitle = {0} - Eclipse Platform +AbstractDTreeEditor_modelerDescriptionFilesLoadedJob = Refresh +AbstractDTreeEditor_noSessionError = "a DSemanticDecorator must be owned by a Session {0} +AbstractExportRepresentationsAction_cancelled = Cancelled +AbstractExportRepresentationsAction_error = Error +AbstractExportRepresentationsAsImagesDialog_accessError = Access to path is impossible +AbstractExportRepresentationsAsImagesDialog_blankFolderError = Folder cannot be blank +AbstractExportRepresentationsAsImagesDialog_browseLabel = &Browse... +AbstractExportRepresentationsAsImagesDialog_folderDoesNotExist = Folder does not exist +AbstractExportRepresentationsAsImagesDialog_htmlExport = Export to HTML +AbstractExportRepresentationsAsImagesDialog_imageFormatLabel = &Image Format: +AbstractExportRepresentationsAsImagesDialog_invalidFolderPathError = Folder is not a valid path +AbstractSWTCallback_askForDetailName_canceled = Cancel +AbstractSWTCallback_loadResourceError = error loading EMF resource +AbstractSWTCallback_models = Models for "{0}" +AbstractSWTCallback_modelsAndRepresentations = Models and Representations for "{0}" +AbstractSWTCallback_modelsAndRepresentationsInProject = Models and Representations for project {0} +AbstractSWTCallback_modelsInProject = Models for project {0} +AbstractSWTCallback_representations = Representations for "{0}" +AbstractSWTCallback_representationsInProject = Representations for project {0} +AbstractSWTCallback_shouldClose_message=The {0} resource has been externally deleted, should we remove it and lose changes? +AbstractSWTCallback_shouldClose_title=Close the representations file? +AbstractSWTCallback_shouldReload_message=The {0} resource has been externally changed, should we reload it? +AbstractSWTCallback_shouldReload_title = Reload the resource? +AbstractSWTCallback_shouldRemove_message=The {0} resource has been deleted and contains critical data, should we close it? +AbstractSWTCallback_shouldRemove_title=Remove the resource? +AddModelDependencyAction_error = Error adding model dependency +AddModelDependencyAction_resourceSelectionMessage = Select resources to add +AddModelDependencyAction_title = Add Model +AddSemanticResourceAction_title = Add model +ChangeViewpointSelectionCommand_activationError = Unable to activate viewpoint ''{0}'' because of insufficient rights. +ChangeViewpointSelectionCommand_applySelectionTask = Apply new viewpoints selection... +ChangeViewpointSelectionCommand_deselectViewpointTask = Deselect viewpoint: {0} +ChangeViewpointSelectionCommand_label = Change viewpoints selection +ChangeViewpointSelectionCommand_selectViewpointTask = Select viewpoint: {0} +CloseSessionsAction_error = An error occured: {0} +CloseUISessionCommand_closeRepresentationFileTask = Close Representations file +CloseUISessionCommand_closingError = Error while closing the session +CloseUISessionCommand_saveDialogTitle = Representations file +CommonNavigatorTab_name = Navigator +ConfirmationDialogDeleteHook_dialogMessage = Are you sure you want to delete the selected elements? +ConfirmationDialogDeleteHook_dialogTitle = Deletion confirmation +ContextMenuFiller_closeSession = Close +ContextMenuFiller_move = Move +ContextMenuFiller_newRepresentation = New Representation +ContextMenuFiller_saveSession = Save +ContextMenuFiller_saveSessionError = Error at session saving +ContextMenuFiller_showInHierarchy = Show in hierarchy +CopyRepresentationAction_copyRepresentationDialog_title = Copy representation +CopyRepresentationAction_copyRepresentationsDialog_defaultNewName = Copy of +CopyRepresentationAction_copyRepresentationsDialog_message = Prefix for copied representations: +CopyRepresentationAction_copyRepresentationsDialog_title = Copy representations +CopyRepresentationAction_name = Copy +CreateOrAddResourceWizardPage_addResource_details = Add an existing resource to the representations file +CreateOrAddResourceWizardPage_addResource_label = Add existing resource +CreateOrAddResourceWizardPage_createResource_details = Create a new empty resource and add it to the representations file. +CreateOrAddResourceWizardPage_createResource_label = Create resource +CreateOrAddResourceWizardPage_description = Create or select existing resource +CreateOrAddResourceWizard_initialEObject = Select the root instance type and the file encoding +CreateOrAddResourceWizard_modelCreation = Enter the file name and choose the parent container +CreateOrAddResourceWizard_resourceAdditionError = Error adding resource +CreateOrAddResourceWizard_resourceCreationError = Error creating resource +CreateOrAddResourceWizard_resourceNotCreatedError = the new resource was not created on disk +CreateOrAddResourceWizard_selectResourceMessage = Select resources to add +CreateOrAddResourceWizard_windowTitle = Add semantic resource +CreateOrAddResourceWizard_wizardTitle = Add Model Wizard +CreateRepresentationAction_creationTask = Representation creation +CreateRepresentationAction_openingTask = Representation opening +CreateRepresentationFromSessionAction_name = Create Representation +CreateRepresentationFromSessionAction_wizardTitle = Create Representation Wizard +CreateRepresentationWizard_title = Create Representation +CreateSessionResourceWizard_resourceCreationError = Error creating resource +CreateSessionResourceWizard_sessionDataCreationError = Error creating aird session data +CreateSessionResourceWizard_title = Create .aird file +DTableLabelProvider_nbSelectedItems = {0} items selected +DTableLabelProvider_selectedItemsList = {0} [{1}] selected +DefaultDialectEditorDialogFactory_message = The root element has been deleted, the editor will close. +DefaultDialectEditorDialogFactory_title = Deleted root element +DeleteRepresentationAction_closeEditorsTask = Associated editor closing +DeleteRepresentationAction_deleteRepresentationTask = Representation deletion +DeleteRepresentationAction_deleteRepresentationTask_plural = Representations deletion +DeleteRepresentationAction_message = Are you sure you want to delete the selected representation? +DeleteRepresentationAction_message_plural = Are you sure you want to delete the selected representations? +DeleteRepresentationAction_name = Delete +DeleteRepresentationAction_title = Delete representation +DeleteRepresentationAction_title_plural = Delete representations +DesignerControlAction_controlTask = Control resources +DesignerControlAction_saveDialogTitle = Representations file +DesignerControlAction_savingTask = Session saving +DesignerControlAction_uncontrolTask = Uncontrol resources +DesignerInterpreterView_addDependencyButton = Add Dependency +DesignerInterpreterView_addDependencyDialogMessage = Enter the new dependency to add +DesignerInterpreterView_addDependencyDialogTitle = Add Dependency +DesignerInterpreterView_copyToClipboardButton = Copy to Clipboard +DesignerInterpreterView_copyToClipboardResult = Result of: {0} ({1} elements) +DesignerInterpreterView_evaluationResult = Evaluation successful. Number of returned elements : {0}. Time to evaluate : {1} second(s) +DesignerInterpreterView_invalidExpressionError = Invalid expression. {0} +DesignerInterpreterView_requestsInterpreter = Requests interpreter +DesignerInterpreterView_setButton = Set +DesignerInterpreterView_typeVariableName = Type variable name +DesignerInterpreterView_unsetButton = Unset +DesignerInterpreterView_variableName = Variable name +DesignerInterpreterView_variablesSection = Variables +EclipseUISessionFactoryDescriptor_extensionLoadingError = Error while loading the extension {0} +EditorNameAdapter_representationClosingError = Error while closing the representation, the remote server may be unreachable. +ExportAction_defaultDiagramName = DiagramWithoutName +ExportAction_exportDiagramsAsImagesCancelled = The operation was cancelled +ExportAction_exportDiagramsAsImagesTitle = Export Diagrams as images +ExportAction_exportError = Error while export representation to image +ExportAction_exportImpossibleTitle = Image export impossible +ExportAction_imagesTooLargeMessage = One or more representations could not be exported because they are too large: +ExportAction_memAllocError = Not enough memory available to create image files +ExportOneRepresentationAsImageDialog_dialogTitle = Export representation as image file +ExportOneRepresentationAsImageDialog_exportToImage = Export to Image +ExportOneRepresentationAsImageDialog_invalidFilePath = Invalid file path +ExportOneRepresentationAsImageDialog_invalidPath = Invalid path +ExportOneRepresentationAsImageDialog_toFile = To file +ExportRepresentationsAction_label = Export representations as images +ExportRepresentationsAction_noRepresentationsDialog_message = The selected elements do not contain any representation to export. +ExportRepresentationsAction_noRepresentationsDialog_title = Export representations +ExportRepresentationsFromFileAction_errorDialog_title = Error +ExportRepresentationsFromFileAction_exportTask = Export all representations to images +ExportRepresentationsFromFileAction_interruptedDialog_title = Cancelled +ExportRepresentationsFromFileAction_noRepresentationsDialog_message = The selected session do not contain any representation to export. +ExportRepresentationsFromFileAction_noRepresentationsDialog_title = Export representations +ExportSeveralRepresentationsAsImagesDialog_dialogMessage = Select the destination folder +ExportSeveralRepresentationsAsImagesDialog_dialogTitle = Export representations as image file +ExportSeveralRepresentationsAsImagesDialog_toDirectory = To directory +ExtractRepresentationAction_dialogTitle = Extract Representation Wizard +ExtractRepresentationAction_label = Extract to .{0} file ... +ExtractRepresentationsWizard_airdCreationError = Error creating aird session data +ExtractRepresentationsWizard_moveFailed = the move representations encountered an exception +ExtractRepresentationsWizard_moveInterrupted = the move representations action was interrupted +ExtractRepresentationsWizard_pageName = Representations file +ExtractRepresentationsWizard_resourceCreationError = Error creating resource +ExtractRepresentationsWizard_title = Extract views +FilteredCommonTree_missingFilter = Required filter {0} is not present. Filter support of Model Explorer view will not function correctly. +FilteredCommonTree_refreshFilterJob = Refresh Filter +GenericInitialObjectPage_containerLabel = &Model Object +GenericInitialObjectPage_encodingLabel = &XML Encoding +GenericModelCreationPage_fileExtensionError = The file name must end in .{0} +LoadEMFResourceRunnableWithProgress_loadResourceTask = Loading resource +LogThroughActiveDialectEditorLogListener_permissionError = Permission Issue +MarkerDeletionJob_name = Remove modeling marker +MenuHelper_anonymousRepresentation = (unnamed) +ModelingModelProvider_addAnotherRepresentationFile = Add another representations file to "{0}" may invalidate it. +ModelingModelProvider_addAnotherRepresentationFileSeveralProjects = Add another representations file to {0} may invalidate them. +ModelingModelProvider_mainRepresentationFileDeleted = Deletion of the main representations file of \"{0}\" will invalidate it. +ModelingModelProvider_mainRepresentationFilesOfSomeProjectsDeleted = Deletion of the main representations files of some modeling projects ({0}) will invalidate them. +ModelingModelProvider_satusUnsaveDataWillBeLostWithProjectNames = Some modeling projects ({0}) contain unsaved data. This data will be lost. +ModelingModelProvider_satusUnsavedDataWillBeLost = This modeling project contains unsaved data. This data will be lost. +ModelingProjectManagerImpl_addingModelingNatureTask = Add Modeling Project nature +ModelingProjectManagerImpl_convertToModelingProjectTask = Conversion to Modeling Project +ModelingProjectManagerImpl_createModelingProjectTask = Modeling Project creation : {0} +ModelingProjectManagerImpl_createProjectTask = Create project +ModelingProjectManagerImpl_createRepresentationFileTask = Create local representations file +ModelingProjectManagerImpl_openProjectTask = Open project +ModelingProjectManagerImpl_removingModelingNatureTask = Remove Modeling Project nature +ModelingProjectManagerImpl_semanticResourcesAdditionTask = Semantic resources addition +ModelingProjectWizard_title = New Modeling Project +ModelingToggleNatureAction_errorDialogMessage = Impossible to convert the project: {0} +ModelingToggleNatureAction_errorDialogTitle = Convert Project to Modeling project +MoveRepresentationAction_text = move to {0} +NavigateToCommand_name = Navigate to another representation +NewSessionWizard_fileCreationTask = Representations file creation +NewSessionWizard_representationFileCreationError = Error creating Representations File +NewSessionWizard_selectModel = Select model to analyse +NewSessionWizard_title = New Representations File +OpenCloseSessionActionProvider_openCloseAction_close = Close +OpenCloseSessionActionProvider_openCloseAction_open = Open +OpenCloseSessionActionProvider_openWithMenu = Open With +OpenRepresentationsAction_name = Open +OpenRepresentationsAction_openRepresentationTask = Open representation... +OpenRepresentationsAction_openRepresentationsTask = Open representations... +OpenRepresentationsFileJob_errorInvalidInputList = This list must be a list of URI or a list of ModelingProject. +OpenRepresentationsFileJob_initModelingProjectsTask = Initialize modeling projects +OpenRepresentationsFileJob_invalidModelingProjectsError = Several modeling projects are invalid or can not be opened. +OpenRepresentationsFileJob_label = Loading models +OpenRepresentationsFileJob_loadReferencedModelsTask = Loading referenced models of "{0}" +OpenRepresentationsFileJob_loadRepresentationsTask = Load representations and models +OpenRepresentationsFileJob_loadingModelsTask = Loading models +OpenRepresentationsFileJob_loadingProblem_defaultErrorDetail = see Error Log for more details +OpenRepresentationsFileJob_loadingProblem_modelingProject = The modeling project "{0}" is invalid: Problem during loading models: {1} +OpenRepresentationsFileJob_loadingProblem_representationFile = The representations file "{0}" is invalid: Problem during loading models: {1} +OpenRepresentationsFileJob_loadingRepresentationFileTask = Loading representations file "{0}" +OpenRepresentationsFileJob_openingStartRepresentationTask = Opening the startup representations of "{0}" +OpenRepresentationsFileJob_unexpectedException = An unexpected exception was thrown. +OpenSessionOnExpandListener_expandJob = Expand {0} +OpenViewpointSelectionAction_name = Viewpoints Selection +ProjectDependenciesItemImpl_text = Project Dependencies +RefreshLabelImageJob_name = Refreshing lock decorations +RemoveRepresentationResourceAction_name = Remove from representations file +RemoveRepresentationResourceAction_saveDialogTitle = Save representations file before removing the resource? +RemoveSemanticResourceAction_name = Remove Model +RenameRepresentationAction_name = Rename +RepresentationFilesRepairAction_repairError = Repair error +RepresentationFilesRepairAction_repairFailed = Could not run repair process. +RepresentationFilesRepairAction_repairInterrupted = Repair interrupted +RepresentationFilesRepairValidator_askContinue = "Do you want to continue? +RepresentationFilesRepairValidator_askSave = Save changes? +RepresentationFilesRepairValidator_confirmationDialogTitle = Repair confirmation +RepresentationFilesRepairValidator_launchImpossibleRepresentationsOpened = It''s impossible to launch the "{0}" action with opened representations file. So they will be closed before the repair process. +RepresentationFilesRepairValidator_migrationCanceled = Migration canceled by user. +RepresentationFilesRepairValidator_repairActionLabel = Repair +RepresentationFilesRepairValidator_representationFileModified = The following representations file has been modified: +RepresentationFilesRepairValidator_representationFilesModified = The following representations files have been modified: +RepresentationSelectionWizardPage_errorReadonlyContainer = The representation container is read only.\r\n Please select another representation type. +RepresentationSelectionWizardPage_message = Select a representation type +RepresentationSelectionWizardPage_title = Create a new representation +RepresentationsSelectionDialog_shellTitle = Startup representations +RepresentationsSelectionWizardPage_message = Select Representations to export +RepresentationsSelectionWizardPage_pageTitle = Selection of representations to export +RepresentationsSelectionWizardPage_readOnlyContainerError = The representation container is read only.\r\n Please select another representation. +RepresentationsSelectionWizardPage_unknownCodeError = Unknown code result +ResourcesFolderItemImpl_text = Representations per resource +RestoreToLastSavePointListener_errorModifiedResourcesReloaded = {0} modified resources were reloaded. An error occurs while attempting to cancel all modifications. +SelectAnalysisFilePage_browseButton = Browse... +SelectAnalysisFilePage_defaultFileName = newfile +SelectAnalysisFilePage_description = Select the destination file for the views +SelectAnalysisFilePage_existingFileGroup = Extract in an existing file +SelectAnalysisFilePage_existingFileGroup_button = Existing File +SelectAnalysisFilePage_folderExportGroup = Extract in one distinct file per view +SelectAnalysisFilePage_folderExportGroup_button = Folder +SelectAnalysisFilePage_folderSelectionDialogTitle = Please select a Folder +SelectAnalysisFilePage_newFileGroup = Extract in one distinct file per view +SelectAnalysisFilePage_newFileGroup_button = New File +SelectMetamodelWizardPage_browseButton = Browse... +SelectMetamodelWizardPage_description = This page is used to specify the URI of the metamodel +SelectMetamodelWizardPage_noMetamodelType = Metamodel type is not selected +SelectMetamodelWizardPage_registryLabel = &Registry values: +SelectMetamodelWizardPage_statusNoURI = Metamodel URI must be specified +SelectMetamodelWizardPage_statusUnknownURI = Metamodel URI doesn't exist +SelectMetamodelWizardPage_typeValues = &Type values: +SelectMetamodelWizardPage_uriLabel = &Metamodel URI: +SelectMetamodelWizardPage_workspaceDialogTitle = Select the metamodel in the workspace +SelectRepresentationsWizard_title = Wizard of representations selection +SemanticElementSelectionWizardPage_message = Select a semantic element for the new representation +SemanticElementSelectionWizardPage_title = Create a new representation +SemanticResourceAdditionOperation_semanticResourceAdditionTask = Semantic resource addition +SemanticResourceDialog_representationFilesCantBeAdded_message = Representation files can not be added as semantic resources, they will be removed from the selection. +SemanticResourceDialog_representationFilesCantBeAdded_status = Representation files can not be added as semantic resources: {0} +SemanticResourceDialog_representationFilesCantBeAdded_title = Incorrect selection +SessionEditorInput_defaultEditorName = Default_Representation_Editor +SessionFileCreationWizardPage_description = Create a new representations file resource +SessionFileCreationWizardPage_errorMessage = The selected Modeling Project already has its representations file +SessionFileCreationWizardPage_noSelectionFileName = representations +SessionFileCreationWizardPage_title = Representations File +SessionHelper_openStartupRepresentationsTask = Open startup representations +SessionHelper_origin = from {0} project +SessionHelper_selectionDialogMessage = Select the startup representations to open +SessionHelper_selectionDialogMessageWithOrigin = Select the startup representations to open {0} +SessionHelper_selectionDialogTitle = Select startup representations +SessionHelper_startupRepresentationOpeningTask = Startup representations opening +SessionKindSelectionWizardPage_description = Choose initialization kind +SessionKindSelectionWizardPage_emptyFile_details = Create a new empty representations file. You will be able after to associate this file with one or more semantic resources. +SessionKindSelectionWizardPage_emptyFile_label = Empty file +SessionKindSelectionWizardPage_initialization_details = Link the new representations file to a semantic resource. You will be able to associate this representations file with other semantic ressources. +SessionKindSelectionWizardPage_initialization_label = Initialization from a semantic resource +SessionKindSelectionWizardPage_title = Representations File +SessionLabelProvider_errorReadingModel = Error while reading to the model +SessionResourceCreationWizardPage_noSelectionFileName = newDiagrams +SessionResourceCreationWizardPage_wrongFileExtension = The file extension is wrong. It should be {0} +SessionSpecificEditorInput_transformationFailure = Failing of EditorInput transformation. +SiriusCellEditorProviderCollector_contributionInstantiationError = Cannot instantiate the Cell Editor Provider contributions +SiriusCommonContentProvider_asyncUpdateJob = Async viewer updates +SiriusCommonLabelProvider_eClassDisabled = {0}_disabled +SiriusControlHandler_controlTask = Control resources +SiriusPreferencePage_autoRefresh = Automatic Refresh +SiriusPreferencePage_defensiveEditValidation = Validate file edits on command application. +SiriusPreferencePage_emptyAirdOnControl = Always create an aird fragment on control +SiriusPreferencePage_emptyAirdOnControl_help = Allow the creation of an empty aird fragment if there is no selected representation +SiriusPreferencePage_enableGrouping = Enable +SiriusPreferencePage_enableGrouping_help = This feature handles a new intermediary tree level if the children size is above the threshold. +SiriusPreferencePage_filesGroup = Files +SiriusPreferencePage_groupingGroup = Group tree items +SiriusPreferencePage_groupingGroupSize = Group size +SiriusPreferencePage_groupingGroupSize_help = Group size needs to be higher than zero. +SiriusPreferencePage_groupingTheshold = Threshold +SiriusPreferencePage_groupingTheshold_help = The threshold needs to be higher or equal to the group size (otherwise Threshold = Group size). +SiriusPreferencePage_profilerGroup = Profiler +SiriusPreferencePage_profiling = Profiling +SiriusPreferencePage_profiling_help = Open the profiler view: Sirius Profiler > Time Profiler View. +SiriusPreferencePage_refreshGroup = Refresh +SiriusPreferencePage_refreshOnRepresentationOpening = Do refresh on representation opening +SiriusUncontrolHandler_uncontrolRepresentationsMessage = Do you want to uncontrol representations in addition to the semantic elements? +SiriusUncontrolHandler_uncontrolRepresentationsTitle = Uncontrol representations? +SiriusUncontrolHandler_uncontrolTask = Uncontrol resources +SmartDialogAnalysisSelector_message = Select an Analysis: +SmartDialogAnalysisSelector_title = Analysis selection +SpecificEditorInputTranformer_defaultFileName = file +SpecificEditorInputTranformer_newRepresentationName = new representation +SpecificEditorInputTranformer_transformationFailure = Failing of EditorInput transformation. +TraceabilityMarkerNavigationProvider_dialogMessage = Select the Representations (referencing {0}) you would like to open. +TraceabilityMarkerNavigationProvider_dialogTitle = Open representations referencing {0} +TraceabilityMarkerNavigationProvider_noSessionFoundError = We can''t find a session associated to the given editor "{0}" +TreeEditorDialogFactory_error = An error occured in {0} +UserSession_openRepresentationTask = Open representation... +UserSession_representationNotFound = Cannot find representation: {0} +UserSession_viewpointSelectionFailed = Cannot select viewpoints: {0}. +ViewpointItemImpl_notFoundLabel = "Not found" +ViewpointSelectionCallbackWithConfimation_viewpointUsedInOpenEditors_message = The viewpoint {0} is used by these opened editors:\n\n{1}\nDisabling this viewpoint will close the concerned editors without saving. Continue? +ViewpointSelectionCallbackWithConfimation_viewpointUsedInOpenEditors_title = Confirmation dialog +ViewpointSelectionCallback_deselection = Viewpoint deselection: {0} +ViewpointSelectionCallback_selection = Viewpoint selection: {0} +ViewpointSelectionDialog_description = Description +ViewpointSelectionDialog_dialogTitle = Selected viewpoints +ViewpointSelectionDialog_message = Select which viewpoints should be enabled in the session. +ViewpointSelectionDialog_selectionMessage = Change viewpoints selection status (see tooltip for details about each viewpoint) +ViewpointSelectionDialog_text = Viewpoints Selection +ViewpointSelectionDialog_title = Viewpoints Selection +ViewpointSelection_applySelectionTask = Apply new viewpoints selection... +ViewpointSelection_loadingViewpointsTask = Loading viewpoints... +ViewpointSelection_missingDependencies_header = The list of selected viewpoints is invalid; please fix the problems: +ViewpointSelection_missingDependencies_requirements = {0} requires {1} +ViewpointSelection_iconColumn = icon +ViewpointSelection_viewpointColumn = Viewpoint +ViewpointSelection_viewpointsMapNotReused = Original and new lists of viewpoints should not be 'different' +ViewpointSelection_wizardTitle = Viewpoints selection +ViewpointsFolderItemImpl_representationsPerCategory_title = Representations per category +ViewpointsSelectionWizardPage_documentation_none = no documentation for this viewpoint +ViewpointsSelectionWizardPage_documentation_title = Documentation +ViewpointsSelectionWizardPage_message = Select viewpoints to activate +ViewpointsSelectionWizardPage_title = Select viewpoints ModelingModelProvider.name=Sirius Modeling Workspace category.siriusCommands.name = Sirius Commands command.control.name = Control @@ -28,7 +356,6 @@ commonFilter.representationPerResource.description = Hides "Representations per commonFilter.representationPerResource.name = Representations per resource commonFilter.representations.description = Hides the representations in the model tree commonFilter.representations.name = Representations as child of the represented element -exportRepresentationsAsImagesActionLabel=Export representations as images extension-point.assistContentProvider.name = org.eclipse.sirius.ui.assistContentProvider extension-point.dialectUI.name = org.eclipse.sirius.dialect.ui extension-point.exporteAsImages.name = org.eclipse.sirius.ui.exportRepresentationsAsImages diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/delete/ConfirmationDialogDeleteHook.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/delete/ConfirmationDialogDeleteHook.java index 1cc41952fc..cee11b5302 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/delete/ConfirmationDialogDeleteHook.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/delete/ConfirmationDialogDeleteHook.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -18,22 +18,21 @@ import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.sirius.business.api.delete.IDeleteHook; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; /** * A example delete hook to confirm deletion. - * + * * @author mchauvin * @since 0.9.0 */ public class ConfirmationDialogDeleteHook implements IDeleteHook { - /** - * {@inheritDoc} - */ + @Override public IStatus beforeDeleteCommandExecution(Collection<DSemanticDecorator> selections, Map<String, Object> parameters) { Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - boolean confirmation = MessageDialog.openConfirm(shell, "Deletion confirmation", "Are you sure you want to delete the selected elements?"); + boolean confirmation = MessageDialog.openConfirm(shell, Messages.ConfirmationDialogDeleteHook_dialogTitle, Messages.ConfirmationDialogDeleteHook_dialogMessage); if (confirmation) { return Status.OK_STATUS; } else { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/DefaultDialectEditorDialogFactory.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/DefaultDialectEditorDialogFactory.java index 2da490322b..ca32967f2e 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/DefaultDialectEditorDialogFactory.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/DefaultDialectEditorDialogFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -11,43 +11,31 @@ package org.eclipse.sirius.ui.business.api.dialect; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Shell; /** * Default dialog factory. - * + * * @author mchauvin * @since 0.9.0 */ public class DefaultDialectEditorDialogFactory implements DialectEditorDialogFactory { - /** Deleted diagram dialog title. */ - public static final String ELEMENT_HAS_BEEN_DELETED_TITLE = "Deleted root element"; + public static final String ELEMENT_HAS_BEEN_DELETED_TITLE = Messages.DefaultDialectEditorDialogFactory_title; /** * Deleted diagram dialog message. */ - private static final String ELEMENT_HAS_BEEN_DELETED = "The root element has been deleted, the editor will close."; + private static final String ELEMENT_HAS_BEEN_DELETED = Messages.DefaultDialectEditorDialogFactory_message; - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.business.api.dialect.DialectEditorDialogFactory#editorWillBeClosedInformationDialog(org.eclipse.swt.widgets.Shell) - */ + @Override public void editorWillBeClosedInformationDialog(Shell parent) { MessageDialog.openInformation(parent, ELEMENT_HAS_BEEN_DELETED_TITLE, ELEMENT_HAS_BEEN_DELETED); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.business.api.dialect.DialectEditorDialogFactory#informUserOfEvent(int, - * java.lang.String) - */ + @Override public void informUserOfEvent(int severity, String message) { // Default implementation is to do nothing - } - } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/marker/TraceabilityMarkerNavigationProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/marker/TraceabilityMarkerNavigationProvider.java index e0acbdfa44..675332539a 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/marker/TraceabilityMarkerNavigationProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/marker/TraceabilityMarkerNavigationProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.api.dialect.marker; +import java.text.MessageFormat; import java.util.Map; import java.util.Set; @@ -42,6 +43,7 @@ import org.eclipse.sirius.ui.tools.api.views.ViewHelper; import org.eclipse.sirius.ui.tools.internal.views.common.SessionLabelProvider; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationElement; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; @@ -72,7 +74,7 @@ import com.google.common.collect.Sets; * it (ask the user if severals are found) and then reveal the element calling * goToMarker on it.</li> * </ul> - * + * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> */ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { @@ -132,7 +134,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Creates a new {@link TraceabilityMarkerNavigationProvider}. - * + * * @param editor * the editor to focus in priority - can be null */ @@ -151,14 +153,14 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { if (currentEditor.some()) { editorTitle = currentEditor.get().getTitle(); } - throw new IllegalArgumentException("We can't find a session associated to the given editor \"" + editorTitle + "\""); + throw new IllegalArgumentException(MessageFormat.format(Messages.TraceabilityMarkerNavigationProvider_noSessionFoundError, editorTitle)); } } /** * Create a new {@link TraceabilityMarkerNavigationProvider} without having * an editor. - * + * * @param session * session to open. */ @@ -168,15 +170,15 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Indicates if the given marker is a Traceability marker. - * + * * @param marker * the marker to test * @return true if the given marker is a Traceability marker, false * otherwise */ public static boolean isTraceabilityMarker(final IMarker marker) { - String elementURI = marker.getAttribute(TRACEABILITY_SEMANTIC_ELEMENT_URI_ATTRIBUTE, null); - String internalAttribute = marker.getAttribute(TRACEABILITY_INTERNAL_ATTRIBUTE, null); + String elementURI = marker.getAttribute(TraceabilityMarkerNavigationProvider.TRACEABILITY_SEMANTIC_ELEMENT_URI_ATTRIBUTE, null); + String internalAttribute = marker.getAttribute(TraceabilityMarkerNavigationProvider.TRACEABILITY_INTERNAL_ATTRIBUTE, null); return (elementURI != null) && (internalAttribute == null); } @@ -199,16 +201,18 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { * referencer it can be done efficiently), open it (ask the user if severals * are found) and then reveal the element calling goToMarker on it.</li> * </ul> - * + * * @param marker * a marker containing at least an * {@link EValidator#URI_ATTRIBUTE} containing the URI of the * semantic element to go to */ + @Override public void gotoMarker(final IMarker marker) { if (Display.getCurrent() == null) { /* we are not in a UI thread */ Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { gotoMarkerInUIThread(marker); } @@ -222,7 +226,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Execute the goToMarker logic. <b>Must be executed in UIThread</b> - * + * * @param marker * a marker containing at least an * {@link EValidator#URI_ATTRIBUTE} containing the URI of the @@ -239,7 +243,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { EditingDomain editingDomain = currentSession.getTransactionalEditingDomain(); EObject semanticElement = null; - String traceabilityAttribute = marker.getAttribute(TRACEABILITY_SEMANTIC_ELEMENT_URI_ATTRIBUTE, null); + String traceabilityAttribute = marker.getAttribute(TraceabilityMarkerNavigationProvider.TRACEABILITY_SEMANTIC_ELEMENT_URI_ATTRIBUTE, null); if (traceabilityAttribute != null) { URI uri = URI.createURI(traceabilityAttribute); semanticElement = editingDomain.getResourceSet().getEObject(uri, true); @@ -284,7 +288,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { * </p> * <b>The Master Editor is the first Dialect Editor returned by </b> * <code>PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences()</code> - * + * * @return true if the caller editor is a MasterEditor, false otherwise */ private boolean isMasterEditorCall() { @@ -303,7 +307,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Searches for any representation element contained in the given * {@link DialectEditor} that references the given semanticElement. - * + * * @param editor * the {@link DialectEditor} in which search the semanticElement * @param semanticElement @@ -341,7 +345,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Indicates if the given representation Element references the given * semantic element. - * + * * @param representationElement * the representation element to search into * @param semanticElement @@ -356,7 +360,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Sets the focus on the found editor and select the representation element * referencing the search opened element. - * + * * @param marker * the original marker */ @@ -385,10 +389,10 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { IMarker shadowMarker = null; try { shadowMarker = res.createMarker(marker.getType()); - shadowMarker.setAttribute(TRACEABILITY_SEMANTIC_ELEMENT_URI_ATTRIBUTE, EcoreUtil.getURI(this.representationToFocus).toString()); - shadowMarker.setAttribute(REPRESENTATION_ELEMENT_ID, resource.getURIFragment(representationElementToSelect).toString()); - shadowMarker.setAttribute(REPRESENTATION_URI, EcoreUtil.getURI(this.representationToFocus).toString()); - shadowMarker.setAttribute(TRACEABILITY_INTERNAL_ATTRIBUTE, "active"); //$NON-NLS-1$ + shadowMarker.setAttribute(TraceabilityMarkerNavigationProvider.TRACEABILITY_SEMANTIC_ELEMENT_URI_ATTRIBUTE, EcoreUtil.getURI(this.representationToFocus).toString()); + shadowMarker.setAttribute(TraceabilityMarkerNavigationProvider.REPRESENTATION_ELEMENT_ID, resource.getURIFragment(representationElementToSelect).toString()); + shadowMarker.setAttribute(TraceabilityMarkerNavigationProvider.REPRESENTATION_URI, EcoreUtil.getURI(this.representationToFocus).toString()); + shadowMarker.setAttribute(TraceabilityMarkerNavigationProvider.TRACEABILITY_INTERNAL_ATTRIBUTE, "active"); //$NON-NLS-1$ // Step 2 : we sets the focus on the editor and call the goToMarker // method on it @@ -415,7 +419,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { * current active Session</li> * <li>that references the given semanticElement.</li> * </ul> - * + * * @param semanticElement * the searched semantic element * @return true if one of the opened {@link DialectEditor} that are part of @@ -457,7 +461,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { * <b>Note :</b> if several representations are found, a popup will ask to * end-user which one he would like to open. * </p> - * + * * @param semanticElement * the searched semantic element */ @@ -498,7 +502,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * Asks end-user to choose Representation(s) to open in an editor. - * + * * @param candidateRepresentations * all representations that matched the searched element * @param representationToElements @@ -532,6 +536,7 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { final DRepresentation selectedRepresentation = (DRepresentation) selectedRepresentation2; Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { // We create a new Dialect editor final IEditorPart editor = DialectUIManager.INSTANCE.openEditor(currentSession, selectedRepresentation, new NullProgressMonitor()); @@ -556,14 +561,14 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { /** * TreeSelectionDialog used to allow user to select Representations he would * like to open. - * + * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> */ private class RepresentationToOpenDialog extends CheckedTreeSelectionDialog { /** * Constructor. - * + * * @param parent * The shell to parent from. * @param candidateRepresentations @@ -577,15 +582,15 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { candidateRepresentations, session)); SessionLabelProvider labelProvider = new SessionLabelProvider(ViewHelper.INSTANCE.createAdapterFactory()); String objectName = labelProvider.getText(semanticElement); - setTitle("Open representations referencing " + objectName); - setMessage("Select the Representations (referencing " + objectName + ") you would like to open."); + setTitle(MessageFormat.format(Messages.TraceabilityMarkerNavigationProvider_dialogTitle, objectName)); + setMessage(MessageFormat.format(Messages.TraceabilityMarkerNavigationProvider_dialogMessage, objectName)); } } /** * ContentProvider for {@link RepresentationToOpenDialog}. - * + * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> */ private class CandidateRepresentationContentProvider implements ITreeContentProvider { @@ -599,18 +604,22 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { this.session = session; } + @Override public Object[] getElements(Object inputElement) { return candidateRepresentations.toArray(); } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } + @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof Session) { return candidateRepresentations.toArray(); @@ -618,10 +627,12 @@ public class TraceabilityMarkerNavigationProvider implements IGotoMarker { return null; } + @Override public Object getParent(Object element) { return session; } + @Override public boolean hasChildren(Object element) { return element instanceof Session; } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/editor/SpecificEditorInputTranformer.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/editor/SpecificEditorInputTranformer.java index 0c7208633c..9f37844478 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/editor/SpecificEditorInputTranformer.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/editor/SpecificEditorInputTranformer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -50,6 +50,7 @@ import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.DView; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; @@ -59,7 +60,7 @@ import com.google.common.collect.Sets; /** * Transform a standard editor input into a session, by creating silently a * session. - * + * * @author mchauvin * @since 0.9.0 */ @@ -67,7 +68,7 @@ public class SpecificEditorInputTranformer { private static final String SESSION_FILE_EXTENSION = "." + SiriusUtil.SESSION_RESOURCE_EXTENSION; //$NON-NLS-1$ - private static final String DEFAULT_FILE_NAME = "file"; //$NON-NLS-1$ + private static final String DEFAULT_FILE_NAME = Messages.SpecificEditorInputTranformer_defaultFileName; /** * The specific session manager. @@ -97,7 +98,7 @@ public class SpecificEditorInputTranformer { /** * Init environment. - * + * * @param viewpointURI * the viewpoint URI * @param representationDescriptionName @@ -139,7 +140,7 @@ public class SpecificEditorInputTranformer { /** * Transform a standard input into a session one. Session will be * automatically created. - * + * * @param input * the default input * @param selection @@ -164,7 +165,7 @@ public class SpecificEditorInputTranformer { final DRepresentation representation = createSessionAndRepresentation(semanticModelPath, analysisFilenameURI); return createNewEditorInput(representation, semanticModelPath); } catch (final IOException exception) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Failing of EditorInput transformation.", exception)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, Messages.SpecificEditorInputTranformer_transformationFailure, exception)); } catch (CoreException exception) { SiriusEditPlugin.getPlugin().getLog().log(exception.getStatus()); } @@ -176,7 +177,7 @@ public class SpecificEditorInputTranformer { * Create a session and a representation (only if not already created by * initialization of Sirius) from a semantic model path and the analysis * URI. - * + * * @param semanticModelPath * model path * @param analysisFilenameURI @@ -202,7 +203,7 @@ public class SpecificEditorInputTranformer { final EObject semanticModel = session.getSemanticResources().iterator().next().getContents().get(0); activateSirius(); - return createDRepresentation(semanticModel, "new representation"); + return createDRepresentation(semanticModel, Messages.SpecificEditorInputTranformer_newRepresentationName); } private DRepresentation createDRepresentation(final EObject semanticModel, final String name) { @@ -221,7 +222,7 @@ public class SpecificEditorInputTranformer { * Find the representation in the current session which has * <code>representationDescriptionUsed</code> as description and * <code>semanticElement</code> as root. - * + * * @param representationDescriptionUsed * the search representation description * @param semanticElement @@ -245,7 +246,7 @@ public class SpecificEditorInputTranformer { /** * Get the representation description instance in the session editing domain * from another one. - * + * * @param representationDescription * the original representation description * @param semanticModel @@ -275,7 +276,7 @@ public class SpecificEditorInputTranformer { /** * Get the editor input URI from the created representation. additional * operation, such as model elements creation could be done in this method. - * + * * @param representation * the created representation * @return the uri to use @@ -302,7 +303,7 @@ public class SpecificEditorInputTranformer { /** * Get the analysis file URI. - * + * * @param storeInWorkspace * should session file stored in workspace or outside * @param selection @@ -321,7 +322,7 @@ public class SpecificEditorInputTranformer { /** * Get an analysis file URI located in the workspace. - * + * * @param selection * the current selection * @return Workspace analysis file URI @@ -331,29 +332,29 @@ public class SpecificEditorInputTranformer { if (selectedResource instanceof IFile) { final IPath path = getWorkspacePath(selectedResource); if (path != null) { - final String fileName = ((IFile) selectedResource).getName() + SESSION_FILE_EXTENSION; + final String fileName = ((IFile) selectedResource).getName() + SpecificEditorInputTranformer.SESSION_FILE_EXTENSION; return URI.createPlatformResourceURI(path.append(fileName).toString(), true); } } - return URI.createURI(DEFAULT_FILE_NAME + SESSION_FILE_EXTENSION); + return URI.createURI(SpecificEditorInputTranformer.DEFAULT_FILE_NAME + SpecificEditorInputTranformer.SESSION_FILE_EXTENSION); } /** * Get an analysis temporary file URI. - * + * * @return the URI * @throws IOException * if a temporary file could not be created */ protected URI getTempAnalysisURI() throws IOException { - File temp = File.createTempFile(DEFAULT_FILE_NAME, SESSION_FILE_EXTENSION); + File temp = File.createTempFile(SpecificEditorInputTranformer.DEFAULT_FILE_NAME, SpecificEditorInputTranformer.SESSION_FILE_EXTENSION); temp.deleteOnExit(); return URI.createFileURI(temp.getAbsolutePath()); } /** * Get an analysis in memory URI. - * + * * @param selection * the workbench current selection * @return the URI @@ -364,12 +365,12 @@ public class SpecificEditorInputTranformer { final String sessionResourcePath = selectedResource.getFullPath().removeFileExtension().addFileExtension(SiriusUtil.SESSION_RESOURCE_EXTENSION).makeRelative().toString(); return URI.createGenericURI(URIQuery.INMEMORY_URI_SCHEME, sessionResourcePath, null); } - return URI.createGenericURI(URIQuery.INMEMORY_URI_SCHEME, DEFAULT_FILE_NAME + SESSION_FILE_EXTENSION, null); + return URI.createGenericURI(URIQuery.INMEMORY_URI_SCHEME, SpecificEditorInputTranformer.DEFAULT_FILE_NAME + SpecificEditorInputTranformer.SESSION_FILE_EXTENSION, null); } /** * Get the path relative to workspace of a resource. - * + * * @param resource * the resource * @return the relative workspace path of the given resource @@ -386,7 +387,7 @@ public class SpecificEditorInputTranformer { /** * Get the current selected resource from selection. - * + * * @param selection * the current selection * @return the selected resource if there is one, or <code>null</code> diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/resource/LoadEMFResourceRunnableWithProgress.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/resource/LoadEMFResourceRunnableWithProgress.java index 28fa1507df..ffefd3f344 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/resource/LoadEMFResourceRunnableWithProgress.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/resource/LoadEMFResourceRunnableWithProgress.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -18,10 +18,11 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.sirius.business.api.resource.LoadEMFResource; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * Runnable to load an EMF resource. - * + * * @author mchauvin * @since 0.9.0 */ @@ -31,7 +32,7 @@ public class LoadEMFResourceRunnableWithProgress implements IRunnableWithProgres /** * Constructor. - * + * * @param set * the resource set in which to load the file * @param file @@ -41,20 +42,16 @@ public class LoadEMFResourceRunnableWithProgress implements IRunnableWithProgres wrappedRunnable = new LoadEMFResource(set, file); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitor.beginTask("Loading resource", 1); + monitor.beginTask(Messages.LoadEMFResourceRunnableWithProgress_loadResourceTask, 1); wrappedRunnable.run(); monitor.done(); } /** * Returns the loaded resource. - * + * * @return the loaded resource, or <code>null</code> if it could be loaded */ public Resource getLoadedResource() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/EditorNameAdapter.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/EditorNameAdapter.java index 3c53cd27ad..cbe507e52d 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/EditorNameAdapter.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/EditorNameAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -16,6 +16,7 @@ import java.util.List; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.emf.common.notify.impl.AdapterImpl; import org.eclipse.sirius.business.api.session.SessionListener; @@ -23,13 +24,14 @@ import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.ui.business.api.dialect.DialectEditor; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.ViewpointPackage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; /** * Adapter which update name of editors when diagram name change. - * + * * @author pdul */ public class EditorNameAdapter extends AdapterImpl { @@ -42,7 +44,7 @@ public class EditorNameAdapter extends AdapterImpl { /** * Create a new adapter to update the editor title when the diagram name * change. - * + * * @param editingSession * the associated session */ @@ -50,13 +52,8 @@ public class EditorNameAdapter extends AdapterImpl { this.editingSession = editingSession; } - /** - * {@inheritDoc} - * - * @see org.eclipse.emf.ecore.util.EContentAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification) - */ @Override - public void notifyChanged(final org.eclipse.emf.common.notify.Notification n) { + public void notifyChanged(final Notification n) { Object notifier = n.getNotifier(); if (notifier instanceof Adapter) { @@ -88,7 +85,7 @@ public class EditorNameAdapter extends AdapterImpl { /** * Update the editor input name field - * + * * @param editorInput * the editor input * @param editor @@ -96,6 +93,7 @@ public class EditorNameAdapter extends AdapterImpl { */ private void updateEditorInputName(final SessionEditorInput editorInput, final IEditorPart editor) { EclipseUIUtil.displayAsyncExec(new Runnable() { + @Override public void run() { editorInput.setName(editor.getTitle()); } @@ -104,7 +102,7 @@ public class EditorNameAdapter extends AdapterImpl { /** * Add this adapter to the DSemanticDiagram associated to the editor. - * + * * @param editor * the editor */ @@ -117,7 +115,7 @@ public class EditorNameAdapter extends AdapterImpl { /** * Remove this adapter to the DSemanticDiagram associated to the editor. - * + * * @param editor * the editor */ @@ -125,14 +123,11 @@ public class EditorNameAdapter extends AdapterImpl { final DRepresentation representation = editor.getRepresentation(); if (representation != null) { if (representation.eAdapters().contains(this)) { - // TODO remove this try/catch once the offline mode - // will be supported try { representation.eAdapters().remove(this); } catch (NullPointerException e) { if (SiriusEditPlugin.getPlugin().isDebugging()) { - SiriusEditPlugin.getPlugin().getLog().log( - new Status(IStatus.WARNING, SiriusEditPlugin.ID, "Error while closing the representation, the remote server may be unreachable.")); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusEditPlugin.ID, Messages.EditorNameAdapter_representationClosingError)); } } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionEditorInput.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionEditorInput.java index b0602df178..8d4a94f409 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionEditorInput.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionEditorInput.java @@ -25,12 +25,13 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.business.api.session.factory.SessionFactory; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IMemento; /** * Specific URI editor input providing the session data. - * + * * @author cbrun */ public class SessionEditorInput extends URIEditorInput { @@ -42,13 +43,6 @@ public class SessionEditorInput extends URIEditorInput { */ private static final String SESSION_RESOURCE_URI = "SESSION_RESOURCE_URI"; //$NON-NLS-1$ - /** - * Default editor name - * - * @since 0.9.0 - */ - private static final String DEFAULT_EDITOR_NAME = "Default_Representation_Editor"; - private WeakReference<Session> sessionRef; /** @@ -63,7 +57,7 @@ public class SessionEditorInput extends URIEditorInput { /** * Create a new SessionEditorInput with the current session and ui session. - * + * * @param uri * element URI. * @param name @@ -82,7 +76,7 @@ public class SessionEditorInput extends URIEditorInput { /** * Create a new SessionEditorInput with a memento. - * + * * @param memento * a bit of information kept by the platform. * @since 0.9.0 @@ -93,7 +87,7 @@ public class SessionEditorInput extends URIEditorInput { /** * return the model editing session. - * + * * @return the model editing session. */ public Session getSession() { @@ -102,7 +96,7 @@ public class SessionEditorInput extends URIEditorInput { /** * Return the model editing session. - * + * * @param restore * true to restore the session if it is not instantiated or * closed. @@ -113,7 +107,7 @@ public class SessionEditorInput extends URIEditorInput { // Avoid to create a new session if the default editor name is used: we // do not known yet for which representation the input is, like // in the GotoMarker case for example. - if (session == null || (!session.isOpen() && !DEFAULT_EDITOR_NAME.equals(name))) { + if (session == null || (!session.isOpen() && !Messages.SessionEditorInput_defaultEditorName.equals(name))) { URI sessionModelURI = getURI().trimFragment(); if (sessionResourceURI != null) { sessionModelURI = sessionResourceURI; @@ -128,7 +122,7 @@ public class SessionEditorInput extends URIEditorInput { /** * Get the input of this editor input. - * + * * @return the input of this editor input */ public EObject getInput() { @@ -137,7 +131,7 @@ public class SessionEditorInput extends URIEditorInput { /** * Get the input of this editor input. - * + * * @param restore * true to restore the input and associated session if they are * not instantiated @@ -162,10 +156,6 @@ public class SessionEditorInput extends URIEditorInput { return name == null ? super.getName() : name; } - /** - * - * @param string - */ void setName(final String string) { this.name = string; } @@ -173,18 +163,18 @@ public class SessionEditorInput extends URIEditorInput { @Override public void saveState(final IMemento memento) { super.saveState(memento); - memento.putString(NAME_TAG, getName()); - memento.putString(CLASS_TAG, getClass().getName()); + memento.putString(URIEditorInput.NAME_TAG, getName()); + memento.putString(URIEditorInput.CLASS_TAG, getClass().getName()); if (sessionResourceURI != null) { - memento.putString(SESSION_RESOURCE_URI, sessionResourceURI.toString()); + memento.putString(SessionEditorInput.SESSION_RESOURCE_URI, sessionResourceURI.toString()); } } @Override protected void loadState(final IMemento memento) { super.loadState(memento); - setName(memento.getString(NAME_TAG)); - final String sessionResourceURIString = memento.getString(SESSION_RESOURCE_URI); + setName(memento.getString(URIEditorInput.NAME_TAG)); + final String sessionResourceURIString = memento.getString(SessionEditorInput.SESSION_RESOURCE_URI); if (sessionResourceURIString != null) { sessionResourceURI = URI.createURI(sessionResourceURIString); Session newSession = getSession(sessionResourceURI); @@ -196,11 +186,11 @@ public class SessionEditorInput extends URIEditorInput { /** * Get the session. - * + * * @param sessionModelURI * the Session Resource URI * @return the session if it can be found, <code>null</code> otherwise - * + * * @since 0.9.0 */ protected Session getSession(URI sessionModelURI) { @@ -209,13 +199,13 @@ public class SessionEditorInput extends URIEditorInput { /** * Get the session. - * + * * @param sessionModelURI * the Session Resource URI * @param restore * true to restore the session if it is not instantiated * @return the session if it can be found, <code>null</code> otherwise - * + * * @since 0.9.0 */ private Session getSession(URI sessionModelURI, boolean restore) { @@ -273,11 +263,11 @@ public class SessionEditorInput extends URIEditorInput { /** * Create a new input from an Analysis uri. - * + * * @param sessionResourceURI * a session Resource URI. * @return a new SessionEditorinput. - * + * * @since 0.9.0 */ public static SessionEditorInput create(final URI sessionResourceURI) { @@ -287,7 +277,7 @@ public class SessionEditorInput extends URIEditorInput { } catch (CoreException e) { return null; } - return new SessionEditorInput(sessionResourceURI, DEFAULT_EDITOR_NAME, session); + return new SessionEditorInput(sessionResourceURI, Messages.SessionEditorInput_defaultEditorName, session); } @Override @@ -302,7 +292,7 @@ public class SessionEditorInput extends URIEditorInput { * org.eclipse.ui.internal.EditorHistory. This method must not be called by * client, it is automatically called by the dispose of * {@link DDiagramEditor}. - * + * * @deprecated since a {@link org.eclipse.ui.IEditorInput} can be reused by * several instances of {@link org.eclipse.ui.IEditorPart} * through the navigation history view. @@ -328,7 +318,7 @@ public class SessionEditorInput extends URIEditorInput { /** * Overridden to test input existence in a generic way. - * + * * {@inheritDoc} */ @Override diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionHelper.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionHelper.java index 2359005d28..6719cad553 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionHelper.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2009, 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.api.session; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Map; @@ -26,6 +27,7 @@ import org.eclipse.sirius.ui.tools.internal.dialogs.RepresentationsSelectionDial import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -33,9 +35,9 @@ import com.google.common.collect.Maps; /** * Utility class for clients wanting to start their own sessions. - * + * * @author cbrun - * + * */ public final class SessionHelper { @@ -52,7 +54,7 @@ public final class SessionHelper { * <p> * No new representations are created. Only the existing ones are * candidates. - * + * * @param session * the session for which to open the startup representations. * @param monitor @@ -61,19 +63,19 @@ public final class SessionHelper { */ public static void openStartupRepresentations(final Session session, final IProgressMonitor monitor) { try { - monitor.beginTask("Startup representations opening", 1); + monitor.beginTask(Messages.SessionHelper_startupRepresentationOpeningTask, 1); Collection<DRepresentation> startupCandidates = SessionHelper.findAllStartupCandidates(session); String origin = null; if (session.getSessionResource().getURI().segmentCount() > 1) { String projectName = session.getSessionResource().getURI().segment(1); if (projectName != null) { - origin = "from " + projectName + " project"; + origin = MessageFormat.format(Messages.SessionHelper_origin, projectName); } } final Collection<DRepresentation> selection = SessionHelper.selectRepresentationsToOpen(origin, startupCandidates); if (!selection.isEmpty()) { - monitor.subTask("Open startup representations"); + monitor.subTask(Messages.SessionHelper_openStartupRepresentationsTask); } for (final DRepresentation repr : selection) { DialectUIManager.INSTANCE.openEditor(session, repr, new SubProgressMonitor(monitor, 1)); @@ -87,7 +89,7 @@ public final class SessionHelper { * Finds all the existing representations in the session which are marked as * <code>showOnStartup</code> and hence candidates for being automatically * opened. - * + * * @param session * the session in which to look for representations. * @return all the existing representations in the session which are marked @@ -103,7 +105,7 @@ public final class SessionHelper { Collection<DRepresentation> allRepresentations = DialectManager.INSTANCE.getAllRepresentations(session); for (DRepresentation repr : allRepresentations) { RepresentationDescription description = DialectManager.INSTANCE.getDescription(repr); - if (description != null && checkStartupDescInSelectedVps(description, alreadyCheckedDescriptions, selectedViewpoints)) { + if (description != null && SessionHelper.checkStartupDescInSelectedVps(description, alreadyCheckedDescriptions, selectedViewpoints)) { candidates.add(repr); } } @@ -128,7 +130,7 @@ public final class SessionHelper { * automatically opened. If there is only one candidate, it is automatically * selected. If there are more than one, the user is asked to select the * ones he wants (including none) through a modal dialog box. - * + * * @param representationsOrigin * A String representing the origin of the candidates (for * example "from projectName", or @@ -146,14 +148,15 @@ public final class SessionHelper { selection.addAll(candidates); } else if (candidates.size() > 1) { EclipseUIUtil.displaySyncExec(new Runnable() { + @Override public void run() { final Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); final RepresentationsSelectionDialog dlg = new RepresentationsSelectionDialog(shell, candidates); dlg.create(); - dlg.setTitle("Select startup representations"); - String message = "Select the startup representations to open"; + dlg.setTitle(Messages.SessionHelper_selectionDialogTitle); + String message = Messages.SessionHelper_selectionDialogMessage; if (representationsOrigin != null) { - message += " " + representationsOrigin; + message = MessageFormat.format(Messages.SessionHelper_selectionDialogMessageWithOrigin, representationsOrigin); } dlg.setMessage(message); if (dlg.open() == Window.OK) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionSpecificEditorInput.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionSpecificEditorInput.java index 3063c7f1a4..4601bf6694 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionSpecificEditorInput.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/SessionSpecificEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -23,6 +23,7 @@ import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.ui.business.api.editor.SpecificEditorInputTranformer; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IMemento; @@ -125,7 +126,7 @@ public class SessionSpecificEditorInput extends SessionEditorInput { session = SessionManager.INSTANCE.getSession(((DSemanticDecorator) representation).getTarget()); } } catch (final IOException exception) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Failing of EditorInput transformation.", exception)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, Messages.SessionSpecificEditorInput_transformationFailure, exception)); } catch (CoreException exception) { SiriusEditPlugin.getPlugin().getLog().log(exception.getStatus()); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/UserSession.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/UserSession.java index 6adfe9e779..a15aef092b 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/UserSession.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/UserSession.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -11,6 +11,7 @@ package org.eclipse.sirius.ui.business.api.session; import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; import java.util.Arrays; import java.util.Collection; import java.util.Set; @@ -39,6 +40,7 @@ import org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelection import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; @@ -47,7 +49,7 @@ import com.google.common.collect.Sets; /** * An API to manipulate user session easily. - * + * * @provisional this class may be modified and renamed. API may change in future * release without depreciation. * @author mchv @@ -59,7 +61,7 @@ public class UserSession { /** * Instantiate a new user session from a session. - * + * * @param session * the session to wrap */ @@ -69,7 +71,7 @@ public class UserSession { /** * Instantiate a new user session from a session. - * + * * @param session * the session to wrap * @return a {@link UserSession} instance @@ -81,7 +83,7 @@ public class UserSession { /** * Instantiate a new user session from a model element (representation or * semantic one). - * + * * @param eObject * the model element * @return a {@link UserSession} instance @@ -100,7 +102,7 @@ public class UserSession { /** * Instantiate a new user session from selection. - * + * * @param selection * the current selection * @return a {@link UserSession} instance @@ -121,7 +123,7 @@ public class UserSession { /** * Check if a user session is open. - * + * * @return <code>true</code> if it is, <code>false</code> otherwise. */ public boolean isOpen() { @@ -134,10 +136,10 @@ public class UserSession { /** * Save session. - * + * * @param pm * the progress monitor to use. - * + * * @return the saved user session instance */ public UserSession save(IProgressMonitor pm) { @@ -147,10 +149,10 @@ public class UserSession { /** * Close session. - * + * * @param pm * the progress monitor to use. - * + * * @return the closed user session */ public UserSession close(IProgressMonitor pm) { @@ -160,7 +162,7 @@ public class UserSession { /** * Open a representation from its name. - * + * * @param name * name of the representation to open * @return the user session @@ -170,7 +172,7 @@ public class UserSession { if (representation != null) { openEditor(representation, new NullProgressMonitor()); } else { - SiriusEditPlugin.getPlugin().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Cannot found representation: " + name)); + SiriusEditPlugin.getPlugin().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format(Messages.UserSession_representationNotFound, name))); } return this; } @@ -182,7 +184,7 @@ public class UserSession { /** * Select a viewpoint from its name. - * + * * @param viewpointName * the name of the viewpoint to select * @return the user session @@ -193,7 +195,7 @@ public class UserSession { /** * Select a viewpoint from its name and unselect all the others. - * + * * @param viewpointName * the name of the viewpoint * @return the user session @@ -204,7 +206,7 @@ public class UserSession { /** * Select viewpoints from their name. - * + * * @param viewpointNames * name of viewpoints to select * @return the user session @@ -215,7 +217,7 @@ public class UserSession { /** * Select viewpoints from their name and unselect all the others. - * + * * @param viewpointNames * name of viewpoints to select * @return the user session @@ -227,6 +229,7 @@ public class UserSession { private UserSession selectViewpoints(final Iterable<String> viewpointNames, final boolean onlyThisViewpoints) { try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) { Set<Viewpoint> viewpoints = Sets.newLinkedHashSet(); for (final String viewpointName : viewpointNames) { @@ -237,9 +240,9 @@ public class UserSession { } }); } catch (InvocationTargetException e) { - SiriusEditPlugin.getPlugin().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Cannot select viewpoints: " + viewpointNames + ".", e)); + SiriusEditPlugin.getPlugin().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format(Messages.UserSession_viewpointSelectionFailed, viewpointNames), e)); } catch (InterruptedException e) { - SiriusEditPlugin.getPlugin().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Cannot select viewpoints: " + viewpointNames + ".", e)); + SiriusEditPlugin.getPlugin().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format(Messages.UserSession_viewpointSelectionFailed, viewpointNames), e)); } return this; } @@ -275,7 +278,7 @@ public class UserSession { /** * Get the semantic cross referencer. - * + * * @return the semantic cross referencer. */ public ECrossReferenceAdapter getSemanticCrossReferencer() { @@ -306,7 +309,7 @@ public class UserSession { * instance of {@link DRepresentation} it will be open. If a selection * contains an {@link EObject} which is a target of a representation, this * representation will be open. - * + * * @param selection * the selection * @return the user session @@ -320,7 +323,7 @@ public class UserSession { * selection contains an instance of representation it will be open. If a * selection contains an EObject which is a target of a representation it * will be open. - * + * * @param selection * the selection * @param monitor @@ -329,7 +332,7 @@ public class UserSession { */ public UserSession openRepresentation(final ISelection selection, final IProgressMonitor monitor) { try { - monitor.beginTask("Open representation...", 5); + monitor.beginTask(Messages.UserSession_openRepresentationTask, 5); final EObject selected = getEObject(selection); monitor.worked(1); final DRepresentation representation = findRepresentation(selected); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/analysis/SmartDialogAnalysisSelector.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/analysis/SmartDialogAnalysisSelector.java index cdfd7f57aa..8cf8319c1a 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/analysis/SmartDialogAnalysisSelector.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/session/analysis/SmartDialogAnalysisSelector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2015 THALES GLOBAL SERVICES. + * Copyright (c) 2008-2015 THALES GLOBAL SERVICES 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 @@ -22,6 +22,7 @@ import org.eclipse.sirius.business.api.session.danalysis.DAnalysisSelector; import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.viewpoint.DAnalysis; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -32,7 +33,7 @@ import org.eclipse.ui.dialogs.ElementListSelectionDialog; /** * A dialog which select smartly analysis. - * + * * @author mchauvin */ public class SmartDialogAnalysisSelector implements DAnalysisSelector { @@ -49,7 +50,7 @@ public class SmartDialogAnalysisSelector implements DAnalysisSelector { /** * Asks the user to select the analysis. - * + * * @param allAnalysis * all available analysis * @return selected analysis @@ -80,7 +81,7 @@ public class SmartDialogAnalysisSelector implements DAnalysisSelector { /** * do not allow cancel {@inheritDoc} - * + * * @see org.eclipse.ui.dialogs.SelectionDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) */ @Override @@ -90,8 +91,8 @@ public class SmartDialogAnalysisSelector implements DAnalysisSelector { }; - dialog.setTitle("Analysis selection"); - dialog.setMessage("Select an Analysis :"); + dialog.setTitle(Messages.SmartDialogAnalysisSelector_title); + dialog.setMessage(Messages.SmartDialogAnalysisSelector_message); dialog.setElements(allAnalysis.toArray()); if (dialog.open() == Window.OK) { if (dialog.getFirstResult() != null) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java index 4644a96e97..e1c530729a 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -11,10 +11,12 @@ package org.eclipse.sirius.ui.business.api.viewpoint; import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; @@ -68,6 +70,7 @@ import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand; import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; @@ -89,22 +92,23 @@ import com.google.common.base.Predicates; import com.google.common.collect.Collections2; import com.google.common.collect.HashMultimap; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; /** * A class which to show swt widgets with available viewpoints. - * + * * @author mchauvin */ public final class ViewpointSelection { - private static final String VIEWPOINT_SELECTION_WIZARD_PAGE_TITLE = "Viewpoints selection"; + private static final String VIEWPOINT_SELECTION_WIZARD_PAGE_TITLE = Messages.ViewpointSelection_wizardTitle; private static final String VIEWPOINTS_SELECTION_WIZARD_PAGE_ID = "viewpointsSelection"; //$NON-NLS-1$ - private static final String[] COLUMNS = { " ", "icon", "Viewpoint" }; //$NON-NLS-1$ + private static final String[] COLUMNS = { " ", Messages.ViewpointSelection_iconColumn, Messages.ViewpointSelection_viewpointColumn }; //$NON-NLS-1$ /** * Avoid instantiation. @@ -115,7 +119,7 @@ public final class ViewpointSelection { /** * Return the lists of corresponding viewpoints. - * + * * @param fileExtension * The extension of the semantic model * @return The set of corresponding viewpoints, sorted with workspace @@ -123,6 +127,7 @@ public final class ViewpointSelection { */ public static Set<Viewpoint> getViewpoints(final String fileExtension) { final Predicate<Viewpoint> isValidViewpoint = new Predicate<Viewpoint>() { + @Override public boolean apply(final Viewpoint viewpoint) { return new ViewpointQuery(viewpoint).handlesSemanticModelExtension(fileExtension != null ? fileExtension : StringUtil.JOKER_STRING); } @@ -136,7 +141,7 @@ public final class ViewpointSelection { /** * Return the lists of corresponding viewpoints. - * + * * @param fileExtensions * The extensions of the semantic models * @return The list of corresponding viewpoints @@ -151,7 +156,7 @@ public final class ViewpointSelection { /** * Returns the semantic extensions of the given session. - * + * * @param session * the session. * @return the semantic extensions of the given session. @@ -171,7 +176,7 @@ public final class ViewpointSelection { /** * Create a selection wizard page to select a viewpoint. - * + * * @param fileExtension * the semantic file extension. * @param viewpointsMap @@ -187,14 +192,16 @@ public final class ViewpointSelection { viewpointsMap.put(viewpoint, Boolean.FALSE); } - final WizardPage page = new WizardPage(VIEWPOINTS_SELECTION_WIZARD_PAGE_ID, VIEWPOINT_SELECTION_WIZARD_PAGE_TITLE, null) { + final WizardPage page = new WizardPage(ViewpointSelection.VIEWPOINTS_SELECTION_WIZARD_PAGE_ID, ViewpointSelection.VIEWPOINT_SELECTION_WIZARD_PAGE_TITLE, null) { + @Override public void createControl(final Composite parent) { setControl(ViewpointSelection.createViewpointsTableControl(parent, this.getContainer(), viewpointsMap)); } private boolean isThereOneSelectedViewpoint() { return Maps.filterValues(viewpointsMap, new Predicate<Boolean>() { + @Override public boolean apply(final Boolean input) { return input.booleanValue(); } @@ -217,7 +224,7 @@ public final class ViewpointSelection { /** * A cell modifier which applies to a wizard page. - * + * * @author mchauvin */ private static class WizardViewpointsTableLazyCellModifier extends ViewpointsTableLazyCellModifier { @@ -232,14 +239,11 @@ public final class ViewpointSelection { this.wizardContainer = wizardContainer; } - /** - * {@inheritDoc} - */ @Override public void modify(final Object element, final String property, final Object value) { super.modify(element, property, value); - if (property.equals(COLUMNS[0])) { + if (property.equals(ViewpointSelection.COLUMNS[0])) { this.wizardContainer.updateButtons(); } } @@ -247,7 +251,7 @@ public final class ViewpointSelection { /** * Create a selection wizard page to select a viewpoint. - * + * * @param semanticModel * the semantic model or null. * @param viewpointsMap @@ -268,17 +272,17 @@ public final class ViewpointSelection { /** * Create and open a new dialog to change the viewpoints selection status. - * + * * @param session * the session */ public static void openViewpointsSelectionDialog(final Session session) { - openViewpointsSelectionDialog(session, true); + ViewpointSelection.openViewpointsSelectionDialog(session, true); } /** * Create and open a new dialog to change the viewpoints selection status. - * + * * @param session * the session * @param createNewRepresentations @@ -292,9 +296,10 @@ public final class ViewpointSelection { org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry registry = (org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry) ViewpointRegistry.getInstance(); org.eclipse.sirius.business.internal.movida.ViewpointSelection selection = DAnalysisSessionHelper.getViewpointSelection(registry, (DAnalysisSession) session); Set<URI> selectedBefore = selection.getSelected(); - ViewpointSelectionDialog vsd = new ViewpointSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), registry, selection, getSemanticFileExtensions(session)); + ViewpointSelectionDialog vsd = new ViewpointSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), registry, selection, + ViewpointSelection.getSemanticFileExtensions(session)); if (vsd.open() == Window.OK) { - applyViewpointSelectionChange(session, selection, selectedBefore); + ViewpointSelection.applyViewpointSelectionChange(session, selection, selectedBefore); } } else { session.getSemanticCrossReferencer(); @@ -311,7 +316,7 @@ public final class ViewpointSelection { * Compute the error message for the given missing dependencies which * indicates the required viewpoinst activation to complete the current * selection. - * + * * @param missingDependencies * a map with an entry for each select viewpoint which has * missing dependencies. The entry's key is the viewpoint name, @@ -321,12 +326,19 @@ public final class ViewpointSelection { * activation to complete the current selection. */ public static String getMissingDependenciesErrorMessage(Map<String, Collection<String>> missingDependencies) { - return "The list of selected viewpoints is invalid; please fix the problems:\n" + "- " - + Joiner.on("\n- ").withKeyValueSeparator(" requires: ").join(Maps.transformValues(missingDependencies, new Function<Collection<String>, String>() { - public String apply(java.util.Collection<String> from) { - return Joiner.on(", ").join(from); - } - })); + Function<Collection<String>, String> toStringList = new Function<Collection<String>, String>() { + @Override + public String apply(java.util.Collection<String> from) { + return Joiner.on(", ").join(from); //$NON-NLS-1$ + } + }; + StringBuilder sb = new StringBuilder(Messages.ViewpointSelection_missingDependencies_header).append("\n"); //$NON-NLS-1$ + List<String> lines = Lists.newArrayList(); + for (Map.Entry<String, Collection<String>> entry : missingDependencies.entrySet()) { + lines.add("- " + MessageFormat.format(Messages.ViewpointSelection_missingDependencies_requirements, entry.getKey(), toStringList.apply(entry.getValue()))); //$NON-NLS-1$ + } + sb.append(Joiner.on("\n").join(lines)); //$NON-NLS-1$ + return sb.toString(); } private static void applyViewpointSelectionChange(final Session session, org.eclipse.sirius.business.internal.movida.ViewpointSelection selection, Set<URI> selectedBefore) { @@ -335,11 +347,13 @@ public final class ViewpointSelection { Set<URI> newDeselected = Sets.difference(selectedBefore, selectedAfter); final ViewpointSelection.Callback callback = new ViewpointSelectionCallbackWithConfimation(); final Set<Viewpoint> newSelectedViewpoints = Sets.newHashSet(Iterables.transform(newSelected, new Function<URI, Viewpoint>() { + @Override public Viewpoint apply(URI from) { return SiriusResourceHelper.getCorrespondingViewpoint(session, from, true).get(); } })); final Set<Viewpoint> newDeselectedViewpoints = Sets.newHashSet(Iterables.transform(newDeselected, new Function<URI, Viewpoint>() { + @Override public Viewpoint apply(URI from) { return SiriusResourceHelper.getCorrespondingViewpoint(session, from, true).get(); } @@ -351,9 +365,10 @@ public final class ViewpointSelection { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); IRunnableContext context = new ProgressMonitorDialog(shell); IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override public void run(final IProgressMonitor monitor) { try { - monitor.beginTask("Apply new viewpoints selection...", 1); + monitor.beginTask(Messages.ViewpointSelection_applySelectionTask, 1); Command command = new ChangeViewpointSelectionCommand(session, callback, newSelectedViewpoints, newDeselectedViewpoints, new SubProgressMonitor(monitor, 1)); TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); domain.getCommandStack().execute(command); @@ -378,7 +393,7 @@ public final class ViewpointSelection { /** * Compute the missing viewpoint dependencies (if any) for all the * viewpoints enabled by the user. - * + * * @param selected * the viewpoints selection request by the user. * @return for each selected viewpoint which has missing dependencies, an @@ -387,6 +402,7 @@ public final class ViewpointSelection { */ public static Map<String, Collection<String>> getMissingDependencies(Set<Viewpoint> selected) { Set<String> selectedURIs = Sets.newHashSet(Iterables.filter(Iterables.transform(selected, new Function<Viewpoint, String>() { + @Override public String apply(Viewpoint from) { Option<URI> uri = new ViewpointQuery(from).getViewpointURI(); if (uri.some()) { @@ -402,7 +418,7 @@ public final class ViewpointSelection { for (RepresentationExtensionDescription extension : new ViewpointQuery(viewpoint).getAllRepresentationExtensionDescriptions()) { String extended = extension.getViewpointURI(); Pattern pattern = Pattern.compile(extended); - if (!atLeastOneUriMatchesPattern(selectedURIs, pattern)) { + if (!ViewpointSelection.atLeastOneUriMatchesPattern(selectedURIs, pattern)) { result.put(viewpoint.getName(), extended.trim().replaceFirst("^viewpoint:/[^/]+/", "")); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -425,7 +441,7 @@ public final class ViewpointSelection { // newMap is a copy of originalMap with modifications on values. // No elements should have been added. if (originalMap.size() != newMap.size()) { - throw new IllegalArgumentException("Original and new lists of viewpoints should not be 'different'"); + throw new IllegalArgumentException(Messages.ViewpointSelection_viewpointsMapNotReused); } final Set<Viewpoint> newSelectedViewpoints = Sets.newHashSet(); @@ -466,6 +482,7 @@ public final class ViewpointSelection { try { IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override public void run(final IProgressMonitor monitor) { Command command = new ChangeViewpointSelectionCommand(session, callback, newSelectedViewpoints, newDeselectedViewpoints, createNewRepresentations, monitor); TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); @@ -491,8 +508,9 @@ public final class ViewpointSelection { final IProgressService ps = PlatformUI.getWorkbench().getProgressService(); try { ps.busyCursorWhile(new IRunnableWithProgress() { + @Override public void run(final IProgressMonitor pm) { - pm.beginTask("Loading viewpoints...", 4); + pm.beginTask(Messages.ViewpointSelection_loadingViewpointsTask, 4); final Collection<String> semanticFileExtensions = ViewpointSelection.getSemanticFileExtensions(session); pm.worked(1); @@ -560,7 +578,7 @@ public final class ViewpointSelection { editors[i] = null; } - tableViewer.setColumnProperties(COLUMNS); + tableViewer.setColumnProperties(ViewpointSelection.COLUMNS); tableViewer.setCellEditors(editors); cellModifier.setViewer(tableViewer); @@ -580,14 +598,14 @@ public final class ViewpointSelection { /** * A simple callback. - * + * * @author mchauvin */ public interface Callback { /** * Select a {@link Viewpoint}. - * + * * @param viewpoint * the {@link Viewpoint} to select * @param session @@ -599,7 +617,7 @@ public final class ViewpointSelection { /** * Select a {@link Viewpoint}. - * + * * @param viewpoint * the {@link Viewpoint} to select * @param session @@ -615,7 +633,7 @@ public final class ViewpointSelection { /** * deselect a viewpoint. - * + * * @param deselectedViewpoint * the deselected viewpoint * @param session @@ -629,7 +647,7 @@ public final class ViewpointSelection { /** * The label provider - * + * * @author mchauvin */ private static final class ViewpointsTableLabelProvider extends ColumnLabelProvider { @@ -640,7 +658,7 @@ public final class ViewpointSelection { /** * Constructor. - * + * * @param viewpoints * the viewpoints */ @@ -670,9 +688,6 @@ public final class ViewpointSelection { return image; } - /** - * {@inheritDoc} - */ @Override public Image getImage(final Object element) { Image image = null; @@ -711,9 +726,6 @@ public final class ViewpointSelection { return image; } - /** - * {@inheritDoc} - */ @Override public String getText(final Object element) { switch (columnIndex) { @@ -774,14 +786,11 @@ public final class ViewpointSelection { /** * The content provider. - * + * * @author mchauvin */ private static final class ViewpointsTableContentProvider implements IStructuredContentProvider { - - /** - * {@inheritDoc} - */ + @Override @SuppressWarnings("unchecked") public Object[] getElements(final Object inputElement) { if (inputElement instanceof Set<?>) { @@ -791,18 +800,12 @@ public final class ViewpointSelection { return Collections.EMPTY_LIST.toArray(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ + @Override public void dispose() { // nothing to do } - /** - * {@inheritDoc} - */ + @Override public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { // nothing to do } @@ -810,13 +813,13 @@ public final class ViewpointSelection { /** * An common interface which adds a set viewer method. - * + * * @author mchauvin */ private interface TableViewerAwareCellModifier extends ICellModifier { /** * Set the table viewer to update. - * + * * @param viewer * the viewer to update */ @@ -825,7 +828,7 @@ public final class ViewpointSelection { /** * An common abstract class for cell modifiers. - * + * * @author mchauvin */ private abstract static class AbstractViewpointsTableCellModifier implements TableViewerAwareCellModifier { @@ -837,7 +840,7 @@ public final class ViewpointSelection { /** * Cosntructor. - * + * * @param viewpoints * All viewpoints and there selection state. */ @@ -845,22 +848,15 @@ public final class ViewpointSelection { this.viewpoints = viewpoints; } - /** - * {@inheritDoc} - */ + @Override public void setViewer(final TableViewer viewer) { this.tableViewer = viewer; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, - * java.lang.String) - */ + @Override public boolean canModify(final Object element, final String property) { - if (property.equals(COLUMNS[0])) { + if (property.equals(ViewpointSelection.COLUMNS[0])) { /* first column */ return true; } @@ -871,14 +867,14 @@ public final class ViewpointSelection { /** * The cell modifier which only modifies the input map. - * + * * @author mchauvin */ private static class ViewpointsTableLazyCellModifier extends AbstractViewpointsTableCellModifier { /** * Constructor. - * + * * @param viewpoints * All viewpoints and there selection state. */ @@ -886,15 +882,13 @@ public final class ViewpointSelection { super(viewpoints); } - /** - * {@inheritDoc} - */ + @Override public Object getValue(final Object element, final String property) { final Viewpoint viewpoint = (Viewpoint) element; Object result = null; - if (property.equals(COLUMNS[0])) { + if (property.equals(ViewpointSelection.COLUMNS[0])) { /* first column */ result = Boolean.FALSE; @@ -904,7 +898,7 @@ public final class ViewpointSelection { break; } } - } else if (property.equals(COLUMNS[1])) { + } else if (property.equals(ViewpointSelection.COLUMNS[1])) { /* second column */ // do nothing as there is only an image } else { @@ -914,9 +908,7 @@ public final class ViewpointSelection { return result; } - /** - * {@inheritDoc} - */ + @Override public void modify(final Object element, final String property, final Object value) { Object objElement; @@ -927,7 +919,7 @@ public final class ViewpointSelection { objElement = element; } - if (property.equals(COLUMNS[0])) { + if (property.equals(ViewpointSelection.COLUMNS[0])) { final Viewpoint vp = (Viewpoint) objElement; // Convert Object to Boolean without instanceof diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallback.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallback.java index e3b2a84a44..98fed0dc41 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallback.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallback.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -10,46 +10,43 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.api.viewpoint; +import java.text.MessageFormat; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.ViewpointSelector; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * The callback for selection. * <p> * All methods must be executed in transactional mode. * </p> - * + * * @author mchauvin */ public class ViewpointSelectionCallback implements ViewpointSelection.Callback { - /** - * {@inheritDoc} - */ + @Override public void selectViewpoint(Viewpoint viewpoint, Session session, IProgressMonitor monitor) { selectViewpoint(viewpoint, session, true, monitor); } - /** - * {@inheritDoc} - */ + @Override public void selectViewpoint(Viewpoint viewpoint, Session session, boolean createNewRepresentations, IProgressMonitor monitor) { try { - monitor.beginTask("Viewpoint selection : " + viewpoint.getName(), 3); + monitor.beginTask(MessageFormat.format(Messages.ViewpointSelectionCallback_selection, viewpoint.getName()), 3); new ViewpointSelector(session).selectViewpoint(viewpoint, createNewRepresentations, monitor); } finally { monitor.done(); } } - /** - * {@inheritDoc} - */ + @Override public void deselectViewpoint(Viewpoint deselectedViewpoint, Session session, IProgressMonitor monitor) { try { - monitor.beginTask("Viewpoint deselection : " + deselectedViewpoint.getName(), 1); + monitor.beginTask(MessageFormat.format(Messages.ViewpointSelectionCallback_deselection, deselectedViewpoint.getName()), 1); new ViewpointSelector(session).deselectViewpoint(deselectedViewpoint, monitor); } finally { monitor.done(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallbackWithConfimation.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallbackWithConfimation.java index 1c411b3489..84b80d3860 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallbackWithConfimation.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionCallbackWithConfimation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -24,6 +24,7 @@ import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; @@ -33,21 +34,14 @@ import com.google.common.collect.Sets; /** * Asks the user for confirmation when de-selecting a viewpoint if there are * opened editors using this viewpoint. - * + * * <p> * All methods must be executed in transactional mode. * </p> - * + * * @author mchauvin */ public class ViewpointSelectionCallbackWithConfimation extends ViewpointSelectionCallback { - private static final String TITLE = "Confirmation dialog"; - - private static final String QUESTION = "\nDisabling this viewpoint will close the concerned editors without saving. Continue?"; - - /** - * {@inheritDoc} - */ @Override public void deselectViewpoint(Viewpoint deselectedViewpoint, Session session, IProgressMonitor monitor) { IEditingSession editingSession = SessionUIManager.INSTANCE.getUISession(session); @@ -67,13 +61,16 @@ public class ViewpointSelectionCallbackWithConfimation extends ViewpointSelectio StringBuilder builder = new StringBuilder(); for (IEditorPart iEditorPart : openedEditors) { builder.append(iEditorPart.getTitle()); - builder.append(",\n"); + builder.append(",\n"); //$NON-NLS-1$ } - final String message = MessageFormat.format("The viewpoint {0} is used by these opened editors:\n\n{1}{2}", new IdentifiedElementQuery(deselectedViewpoint).getLabel(), builder, QUESTION); + final String message = MessageFormat.format(Messages.ViewpointSelectionCallbackWithConfimation_viewpointUsedInOpenEditors_message, new IdentifiedElementQuery(deselectedViewpoint).getLabel(), + builder); final AtomicBoolean confirmation = new AtomicBoolean(false); Display.getDefault().syncExec(new Runnable() { + @Override public void run() { - confirmation.set(MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), TITLE, message)); + confirmation.set(MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), + Messages.ViewpointSelectionCallbackWithConfimation_viewpointUsedInOpenEditors_title, message)); } }); return confirmation.get(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java index 7c15b8a8df..85fa9c7e46 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -33,6 +33,7 @@ import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.business.internal.movida.ViewpointDependenciesTracker; import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; @@ -333,24 +334,18 @@ public class ViewpointSelectionDialog extends TitleAreaDialog { return roots; } - /** - * {@inheritDoc} - */ @Override protected Control createContents(Composite parent) { Control contents = super.createContents(parent); - setTitle("Viewpoints Selection"); - setMessage("Select which viewpoints should be enabled in the session."); + setTitle(Messages.ViewpointSelectionDialog_title); + setMessage(Messages.ViewpointSelectionDialog_message); Shell shell = parent.getShell(); - shell.setText("Viewpoints Selection"); + shell.setText(Messages.ViewpointSelectionDialog_text); shell.pack(); shell.setSize(shell.getSize().x, 500); return contents; } - /** - * {@inheritDoc} - */ @Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); @@ -361,7 +356,7 @@ public class ViewpointSelectionDialog extends TitleAreaDialog { configureTreeViewer(); Group group = new Group(composite, SWT.SHADOW_IN); - group.setText("Description"); + group.setText(Messages.ViewpointSelectionDialog_description); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); FillLayout layout = new FillLayout(SWT.HORIZONTAL); layout.marginHeight = 5; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java index 6078b51687..fe305d398d 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.internal.commands; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -24,10 +25,11 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.internal.metamodel.helper.ComponentizationHelper; import org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelection.Callback; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * Specific command to change viewpoints selection. - * + * * @author mporhel */ public class ChangeViewpointSelectionCommand extends RecordingCommand { @@ -46,7 +48,7 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { /** * Specific command to change viewpoint selection. - * + * * @param session * the current session. * @param callback @@ -59,7 +61,7 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { * a {@link IProgressMonitor} */ public ChangeViewpointSelectionCommand(Session session, Callback callback, Set<Viewpoint> newSelectedViewpoints, Set<Viewpoint> newDeselectedViewpoints, IProgressMonitor monitor) { - super(session.getTransactionalEditingDomain(), "Change viewpoints selection"); + super(session.getTransactionalEditingDomain(), Messages.ChangeViewpointSelectionCommand_label); this.callback = callback; this.newSelectedViewpoints = newSelectedViewpoints; this.newDeselectedViewpoints = newDeselectedViewpoints; @@ -70,7 +72,7 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { /** * Specific command to change viewpoints selection. - * + * * @param session * the current session. * @param callback @@ -92,9 +94,6 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { this.createNewRepresentations = createNewRepresentations; } - /** - * {@inheritDoc} - */ @Override protected void doExecute() { if (callback == null || session == null) { @@ -102,13 +101,13 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { } try { int nbViewpointsInChange = (newSelectedViewpoints != null ? newSelectedViewpoints.size() + 1 : 0) + (newDeselectedViewpoints != null ? newDeselectedViewpoints.size() : 0); - monitor.beginTask("Apply new viewpoints selection...", nbViewpointsInChange); + monitor.beginTask(Messages.ChangeViewpointSelectionCommand_applySelectionTask, nbViewpointsInChange); if (newSelectedViewpoints != null) { List<Viewpoint> sorted = sortByDependencies(newSelectedViewpoints); monitor.worked(1); for (final Viewpoint viewpoint : sorted) { - monitor.subTask("Select viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel()); + monitor.subTask(MessageFormat.format(Messages.ChangeViewpointSelectionCommand_selectViewpointTask, new IdentifiedElementQuery(viewpoint).getLabel())); try { callback.selectViewpoint(viewpoint, session, createNewRepresentations, new SubProgressMonitor(monitor, 1)); } catch (SecurityException e) { @@ -117,7 +116,7 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { // DAnalysis // Provide a meaningful error message to the end-user - String errorMessage = "Unable to activate viewpoint '" + viewpoint.getName() + "' because of insufficient rights."; + String errorMessage = MessageFormat.format(Messages.ChangeViewpointSelectionCommand_activationError, viewpoint.getName()); // And re-throw the security exception with the previous // as cause @@ -128,7 +127,7 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand { } if (newDeselectedViewpoints != null) { for (final Viewpoint viewpoint : newDeselectedViewpoints) { - monitor.subTask("Deselect viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel()); + monitor.subTask(MessageFormat.format(Messages.ChangeViewpointSelectionCommand_deselectViewpointTask, new IdentifiedElementQuery(viewpoint).getLabel())); callback.deselectViewpoint(viewpoint, session, new SubProgressMonitor(monitor, 1)); } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/LogThroughActiveDialectEditorLogListener.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/LogThroughActiveDialectEditorLogListener.java index f118d8357c..d7c9b4ca03 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/LogThroughActiveDialectEditorLogListener.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/LogThroughActiveDialectEditorLogListener.java @@ -26,6 +26,7 @@ import org.eclipse.sirius.ui.tools.internal.views.common.navigator.SiriusCommonL import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationElement; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorPart; @@ -36,11 +37,11 @@ import com.google.common.base.Predicate; import com.google.common.collect.Iterables; /** - * A {@link ILogListener} that reacts to specific exceptions by logging them through the active {@link DialectEditor} - * (if any). - * + * A {@link ILogListener} that reacts to specific exceptions by logging them + * through the active {@link DialectEditor} (if any). + * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * + * */ public final class LogThroughActiveDialectEditorLogListener implements ILogListener { /** @@ -56,12 +57,6 @@ public final class LogThroughActiveDialectEditorLogListener implements ILogListe private LogThroughActiveDialectEditorLogListener() { } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime.IStatus, java.lang.String) - */ @Override public void logging(IStatus status, String plugin) { boolean hasBeenLoggedThroughDialect = false; @@ -89,7 +84,8 @@ public final class LogThroughActiveDialectEditorLogListener implements ILogListe Display.getDefault().asyncExec(new Runnable() { @Override public void run() { - MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Permission Issue", getErrorMessage(exception)); + MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.LogThroughActiveDialectEditorLogListener_permissionError, + getErrorMessage(exception)); } }); } @@ -105,11 +101,13 @@ public final class LogThroughActiveDialectEditorLogListener implements ILogListe } /** - * Indicates whether the given exception should be logged through the active dialect or not. - * + * Indicates whether the given exception should be logged through the active + * dialect or not. + * * @param exception * the exception that is being logged in the error log - * @return true if the given exception should be logged through the active dialect, false otherwise + * @return true if the given exception should be logged through the active + * dialect, false otherwise */ private boolean shouldBeLoggedThroughDialect(DialectEditor editor, Throwable exception) { // We only log LockedInstance exceptions @@ -153,10 +151,11 @@ public final class LogThroughActiveDialectEditorLogListener implements ILogListe /** * Indicates whether the given exception should be logged through a pop-up. - * + * * @param exception * the exception that is being logged in the error log - * @return true if the given exception should be logged through a pop-up, false otherwise + * @return true if the given exception should be logged through a pop-up, + * false otherwise */ private boolean shouldBeLoggedThroughPopup(Throwable exception) { // We only consider LockedInstanceException @@ -165,7 +164,7 @@ public final class LogThroughActiveDialectEditorLogListener implements ILogListe /** * Returns the error message corresponding to the given exception. - * + * * @param exception * the exception to get the error message from * @return the error message corresponding to the given exception @@ -184,7 +183,7 @@ public final class LogThroughActiveDialectEditorLogListener implements ILogListe /** * Returns the label provider to use for displaying locked elements. - * + * * @return the label provider to use for displaying locked elements. */ private ICommonLabelProvider getLabelProvider() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/TreeEditorDialogFactory.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/TreeEditorDialogFactory.java index e7991fa473..2b87d2e4fb 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/TreeEditorDialogFactory.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/TreeEditorDialogFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,23 +10,26 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.internal.dialect; +import java.text.MessageFormat; + import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.sirius.ui.business.api.dialect.DefaultDialectEditorDialogFactory; import org.eclipse.sirius.ui.tools.internal.editor.AbstractDTreeEditor; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.PlatformUI; /** * Dialog factory for AbstractDTreeEditors. - * + * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * + * */ public class TreeEditorDialogFactory extends DefaultDialectEditorDialogFactory { private AbstractDTreeEditor editor; /** * Default constructor. - * + * * @param abstractDTreeEditor * the editor associated to this * {@link org.eclipse.sirius.ui.business.api.dialect.DialectEditorDialogFactory} @@ -36,12 +39,10 @@ public class TreeEditorDialogFactory extends DefaultDialectEditorDialogFactory { this.editor = abstractDTreeEditor; } - /** - * {@inheritDoc} - */ + @Override public void informUserOfEvent(int severity, String message) { if ((PlatformUI.getWorkbench() != null) && (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null)) { - MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "An error occured in " + editor.getTitle(), message); + MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), MessageFormat.format(Messages.TreeEditorDialogFactory_error, editor.getTitle()), message); } } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java index acf447359d..75336dc013 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/RestoreToLastSavePointListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.internal.session; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -36,12 +37,13 @@ import org.eclipse.sirius.tools.api.command.EditingDomainUndoContext; import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys; import org.eclipse.sirius.viewpoint.DAnalysisSessionEObject; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.PlatformUI; /** * Marker able to restore the command stack to the last save point. - * + * * @author mporhel */ public class RestoreToLastSavePointListener implements ResourceSyncClient, IOperationHistoryListener { @@ -52,7 +54,7 @@ public class RestoreToLastSavePointListener implements ResourceSyncClient, IOper /** * Create a new instance. - * + * * @param session * the session to listen */ @@ -130,7 +132,7 @@ public class RestoreToLastSavePointListener implements ResourceSyncClient, IOper // If something went wrong, we reload the changed resources: reloadTheResources(); String sessionLabel = SiriusEditPlugin.getPlugin().getUiCallback().getSessionNameToDisplayWhileSaving(session); - SiriusPlugin.getDefault().warning(sessionLabel + " modified resources were reloaded. An error occurs while attempting to cancel all modifications.", e); + SiriusPlugin.getDefault().warning(MessageFormat.format(Messages.RestoreToLastSavePointListener_errorModifiedResourcesReloaded, sessionLabel), e); } } @@ -200,7 +202,7 @@ public class RestoreToLastSavePointListener implements ResourceSyncClient, IOper * Returns whether we can perform the entire revert by undoing all * operations. In other words, if the undo history is strictly lower to the * max limit. - * + * * @return true if we can perform the undo, false otherwise. */ private boolean canPerformTheRevertFromOperationHistory() { @@ -213,7 +215,7 @@ public class RestoreToLastSavePointListener implements ResourceSyncClient, IOper /** * Check the DesignerUIPreferencesKeys.PREF_RELOAD_ON_LAST_EDITOR_CLOSE * preference state. - * + * * @return the preference value. */ public boolean isAllowedToReturnToSyncState() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/factory/EclipseUISessionFactoryDescriptor.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/factory/EclipseUISessionFactoryDescriptor.java index 7f9f763a5f..1f9fb42c54 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/factory/EclipseUISessionFactoryDescriptor.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/session/factory/EclipseUISessionFactoryDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,17 +10,20 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.internal.session.factory; +import java.text.MessageFormat; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.sirius.ui.business.api.session.factory.UISessionFactory; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; /** * {@link UISessionFactoryDescriptor} for Eclipse contributions. - * + * * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> */ public class EclipseUISessionFactoryDescriptor extends AbstractUISessionFactoryDescriptor implements UISessionFactoryDescriptor { @@ -30,28 +33,26 @@ public class EclipseUISessionFactoryDescriptor extends AbstractUISessionFactoryD /** * Instantiates a descriptor with all information. - * + * * @param configuration * Configuration element from which to create this descriptor. */ public EclipseUISessionFactoryDescriptor(IConfigurationElement configuration) { super(); this.id = configuration.getDeclaringExtension().getUniqueIdentifier(); - this.overrideValue = configuration.getAttribute(UI_SESSION_FACTORY_OVERRIDE_ATTRIBUTE); + this.overrideValue = configuration.getAttribute(UISessionFactoryDescriptor.UI_SESSION_FACTORY_OVERRIDE_ATTRIBUTE); this.element = configuration; } - /** - * {@inheritDoc} - */ + @Override public UISessionFactory getUISessionFactory() { if (uiSessionFactory == null) { if (Platform.isRunning()) { try { - uiSessionFactory = (UISessionFactory) element.createExecutableExtension(UI_SESSION_FACTORY_CLASS_ATTRIBUTE); + uiSessionFactory = (UISessionFactory) element.createExecutableExtension(UISessionFactoryDescriptor.UI_SESSION_FACTORY_CLASS_ATTRIBUTE); } catch (CoreException e) { SiriusEditPlugin.getPlugin().getLog() - .log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Error while loading the extension " + element.getDeclaringExtension().getUniqueIdentifier(), e)); + .log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format(Messages.EclipseUISessionFactoryDescriptor_extensionLoadingError, element.getDeclaringExtension().getUniqueIdentifier()), e)); } } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/viewpoint/ViewpointSelectionDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/viewpoint/ViewpointSelectionDialog.java index 5cceb816e2..aa917c2932 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/viewpoint/ViewpointSelectionDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/viewpoint/ViewpointSelectionDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2014, 2015 THALES GLOBAL SERVICES 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 @@ -10,9 +10,11 @@ *******************************************************************************/ package org.eclipse.sirius.ui.business.internal.viewpoint; +import java.text.MessageFormat; import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.regex.Matcher; @@ -39,6 +41,7 @@ import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; @@ -67,11 +70,11 @@ import com.google.common.collect.Multimap; * @author <a href="mailto:mickael.lanoe@obeo.fr">Mickael LANOE</a> */ public class ViewpointSelectionDialog extends TitleAreaDialog { - private static final String VIEWPOINT_SELECTION_SHELL_TITLE = "Viewpoints Selection"; + private static final String VIEWPOINT_SELECTION_SHELL_TITLE = Messages.ViewpointSelectionDialog_title; - private static final String VIEWPOINT_SELECTION_TITLE = "Selected viewpoints"; + private static final String VIEWPOINT_SELECTION_TITLE = Messages.ViewpointSelectionDialog_dialogTitle; - private static final String VIEWPOINT_SELECTION_MESSAGE = "Change viewpoints selection status (see tooltip for details about each viewpoint)"; + private static final String VIEWPOINT_SELECTION_MESSAGE = Messages.ViewpointSelectionDialog_selectionMessage; /** * Table item @@ -410,11 +413,17 @@ public class ViewpointSelectionDialog extends TitleAreaDialog { * @return error message */ private static String getMissingDependenciesErrorMessage(Map<String, Collection<String>> missingDependencies) { - return Joiner.on("\n").withKeyValueSeparator(" requires: ").join(Maps.transformValues(missingDependencies, new Function<Collection<String>, String>() { //$NON-NLS-1$ + final Function<Collection<String>, String> toStringList = new Function<Collection<String>, String>() { @Override - public String apply(Collection<String> from) { + public String apply(java.util.Collection<String> from) { return Joiner.on(", ").join(from); //$NON-NLS-1$ } + }; + return Joiner.on("\n").join(Iterables.transform(missingDependencies.entrySet(), new Function<Map.Entry<String, Collection<String>>, String>() { //$NON-NLS-1$ + @Override + public String apply(Entry<String, Collection<String>> entry) { + return MessageFormat.format(Messages.ViewpointSelection_missingDependencies_requirements, entry.getKey(), toStringList.apply(entry.getValue())); + } })); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/AbstractCreateRepresentationFromRepresentationCreationDescription.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/AbstractCreateRepresentationFromRepresentationCreationDescription.java index b0eeaa9fde..d8beadd2a5 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/AbstractCreateRepresentationFromRepresentationCreationDescription.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/AbstractCreateRepresentationFromRepresentationCreationDescription.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2013 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.api.actions; +import java.text.MessageFormat; + import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.notify.AdapterFactory; @@ -40,6 +42,7 @@ import org.eclipse.sirius.viewpoint.description.DescriptionPackage; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.tool.RepresentationCreationDescription; import org.eclipse.sirius.viewpoint.description.tool.ToolPackage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -96,14 +99,8 @@ public abstract class AbstractCreateRepresentationFromRepresentationCreationDesc this.commandFactory = commandFactory; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#isEnabled() - */ @Override public boolean isEnabled() { - boolean isEnabled = super.isEnabled(); if (isEnabled) { if (desc.getRepresentationDescription() == null) { @@ -116,22 +113,12 @@ public abstract class AbstractCreateRepresentationFromRepresentationCreationDesc return isEnabled; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ @Override public String getText() { final IdentifiedElementQuery query = new IdentifiedElementQuery(desc); return query.getLabel(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ @Override public void run() { doCreateRepresentation(); @@ -142,7 +129,7 @@ public abstract class AbstractCreateRepresentationFromRepresentationCreationDesc final IdentifiedElementQuery query = new IdentifiedElementQuery(desc); // default name - String name = "new " + query.getLabel(); + String name = MessageFormat.format(Messages.AbstractCreateRepresentationFromRepresentationCreationDescription_defaultName, query.getLabel()); final String computedName = computeName(target); if (computedName != null) { name = computedName; @@ -159,7 +146,7 @@ public abstract class AbstractCreateRepresentationFromRepresentationCreationDesc if (target != null) { if (!optionalCreatedRepresentation.some()) { final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - MessageDialog.openWarning(shell, "Error creating the representation", "An error occured when trying to create the representation.\nPlease check the representation specification."); + MessageDialog.openWarning(shell, Messages.AbstractCreateRepresentationFromRepresentationCreationDescription_creationError_title, Messages.AbstractCreateRepresentationFromRepresentationCreationDescription_creationError_message); } else { DialectUIManager.INSTANCE.openEditor(SessionManager.INSTANCE.getSession(target.getTarget()), optionalCreatedRepresentation.get(), new NullProgressMonitor()); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/export/ExportAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/export/ExportAction.java index 55f957fce8..6a3870e892 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/export/ExportAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/actions/export/ExportAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -30,13 +30,14 @@ import org.eclipse.sirius.ui.business.api.dialect.ExportFormat; import org.eclipse.sirius.ui.business.api.dialect.ExportFormat.ExportDocumentFormat; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.actions.WorkspaceModifyOperation; /** * Generic export action. - * + * * @author mchauvin */ public class ExportAction extends WorkspaceModifyOperation { @@ -44,13 +45,7 @@ public class ExportAction extends WorkspaceModifyOperation { /** * Export action name. */ - public static final String EXPORT_DIAGRAMS_AS_IMAGES_ACTION_TITLE = "Export Diagrams as images"; - - private static final String EXPORT_DIAGRAMS_AS_IMAGES_ACTION_CANCELLED = "The operation was cancelled"; - - private static final String EXPORT_DIAGRAMS_AS_IMAGES_ACTION_DEFAULT_DIAGRAM_NAME = "DiagramWithoutName"; - - private static final String EXPORT_DIAGRAMS_AS_IMAGES_ACTION_ERROR_ON_MEMORY_ALLOCATION = "Not enough memory available to create image files"; + public static final String EXPORT_DIAGRAMS_AS_IMAGES_ACTION_TITLE = Messages.ExportAction_exportDiagramsAsImagesTitle; private static final char POINT = '.'; @@ -66,7 +61,7 @@ public class ExportAction extends WorkspaceModifyOperation { /** * Default constructor. - * + * * @param session * The {@link Session} which owns the {@link DRepresentation}s to * export as image @@ -90,21 +85,22 @@ public class ExportAction extends WorkspaceModifyOperation { /** * Overridden to do the export work. - * + * * {@inheritDoc} */ + @Override protected void execute(IProgressMonitor monitor) throws CoreException, java.lang.reflect.InvocationTargetException, InterruptedException { try { - monitor.beginTask(EXPORT_DIAGRAMS_AS_IMAGES_ACTION_TITLE, 7); + monitor.beginTask(ExportAction.EXPORT_DIAGRAMS_AS_IMAGES_ACTION_TITLE, 7); try { createImageFiles(monitor); } catch (final OutOfMemoryError e) { - handleException(e, EXPORT_DIAGRAMS_AS_IMAGES_ACTION_ERROR_ON_MEMORY_ALLOCATION); + handleException(e, Messages.ExportAction_memAllocError); } } finally { monitor.done(); if (monitor.isCanceled()) { - throw new InterruptedException(EXPORT_DIAGRAMS_AS_IMAGES_ACTION_CANCELLED); + throw new InterruptedException(Messages.ExportAction_exportDiagramsAsImagesCancelled); } } } @@ -117,7 +113,7 @@ public class ExportAction extends WorkspaceModifyOperation { /** * Create the image files. - * + * * @param monitor * the progress monitor */ @@ -197,7 +193,7 @@ public class ExportAction extends WorkspaceModifyOperation { if (errorDuringExport) { // Construct message for dialog and error in error log. StringBuffer messageExceptionForDialog = new StringBuffer(); - messageExceptionForDialog.append("One or more representations could not be exported because they are too large: "); + messageExceptionForDialog.append(Messages.ExportAction_imagesTooLargeMessage); for (Throwable thr : messageException) { messageExceptionForDialog.append("\n"); //$NON-NLS-1$ messageExceptionForDialog.append(" - "); //$NON-NLS-1$ @@ -205,12 +201,11 @@ public class ExportAction extends WorkspaceModifyOperation { } // Create a popup menu to inform user that representations // export failed - MessageDialog.openError(shell, "Image export impossible", messageExceptionForDialog.toString()); + MessageDialog.openError(shell, Messages.ExportAction_exportImpossibleTitle, messageExceptionForDialog.toString()); // Add in the 'error log' the representations export // failed - SiriusPlugin.getDefault().error("Error while export representation to image", - new SizeTooLargeException(new Status(IStatus.ERROR, SiriusPlugin.ID, messageExceptionForDialog.toString()))); + SiriusPlugin.getDefault().error(Messages.ExportAction_exportError, new SizeTooLargeException(new Status(IStatus.ERROR, SiriusPlugin.ID, messageExceptionForDialog.toString()))); } } } @@ -226,34 +221,34 @@ public class ExportAction extends WorkspaceModifyOperation { * Get the {@link IPath} of the file to write. This method try first to use * the filename given. If the file already exists, it appends a number to * its name. - * + * * @param destinationFolder * the folder where to write the file * @param providedFilename * the name of the file * @param extension * ) the extension of the file - * + * */ private IPath getFilePath(final IPath destinationFolder, final String providedFilename, final String extension) { String filename = null; if (providedFilename.length() == 0) { - filename = new String(EXPORT_DIAGRAMS_AS_IMAGES_ACTION_DEFAULT_DIAGRAM_NAME); + filename = Messages.ExportAction_defaultDiagramName; } else { filename = providedFilename; } IPath filePath; - final StringBuffer file = new StringBuffer(filename).append(POINT).append(extension); + final StringBuffer file = new StringBuffer(filename).append(ExportAction.POINT).append(extension); final String filenameWithExtension = validFilename(file.toString()); if (destinationFolder.append(filenameWithExtension).toFile().exists()) { int version = 1; do { - final String newFileName = validFilename(new StringBuffer(filename).append('_').append(String.valueOf(version)).append(POINT).append(extension).toString()); + final String newFileName = validFilename(new StringBuffer(filename).append('_').append(String.valueOf(version)).append(ExportAction.POINT).append(extension).toString()); filePath = destinationFolder.append(newFileName); version++; } while (filePath.toFile().exists()); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java index ce88b05c04..b75687d0e4 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -11,6 +11,7 @@ package org.eclipse.sirius.ui.tools.api.command; import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; @@ -65,18 +66,12 @@ import com.google.common.collect.Iterables; /** * Implementation of the {@link UICallBack} interface using SWT. - * + * * @author mchauvin * @since 0.9.0 */ public abstract class AbstractSWTCallback implements UICallBack { - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#askForVariableValues(org.eclipse.emf.ecore.EObject, - * org.eclipse.sirius.viewpoint.description.tool.SelectModelElementVariable) - */ + @Override public Collection<EObject> askForVariableValues(final EObject model, final SelectModelElementVariable variable) throws InterruptedException { Collection<EObject> variableValues = new ArrayList<EObject>(); final TreeItemWrapper input = new TreeItemWrapper(null, null); @@ -114,25 +109,17 @@ public abstract class AbstractSWTCallback implements UICallBack { /** * Get the interpreter variable name for representation. - * + * * @return the variable interpreter name for representation */ protected abstract String getVariableNameForRepresentation(); - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#askForDetailName(java.lang.String) - */ + @Override public String askForDetailName(final String defaultName) throws InterruptedException { return askForDetailName(defaultName, null); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#askForDetailName(java.lang.String) - */ + @Override public String askForDetailName(final String defaultName, final String representationDescription) throws InterruptedException { String description = null; if (representationDescription != null && representationDescription.trim().length() > 0) { @@ -146,6 +133,7 @@ public abstract class AbstractSWTCallback implements UICallBack { description += Messages.createRepresentationInputDialog_NewRepresentationNameLabel; final InputDialog askSiriusName = new InputDialog(Display.getDefault().getActiveShell(), Messages.createRepresentationInputDialog_Title, description, defaultName, new IInputValidator() { + @Override public String isValid(final String newText) { return null; } @@ -153,27 +141,20 @@ public abstract class AbstractSWTCallback implements UICallBack { if (askSiriusName.open() == Window.OK) { return askSiriusName.getValue(); } - throw new InterruptedException("Cancel"); + throw new InterruptedException(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_askForDetailName_canceled); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#openEObjectsDialogMessage(java.util.Collection, - * java.lang.String, java.lang.String) - */ + @Override public boolean openEObjectsDialogMessage(final Collection<EObject> objects, final String title, final String message) { return EMFMessageDialog.openQuestionWithEObjects(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ViewHelper.INSTANCE.createAdapterFactory(), objects, title, message); } - /** - * - * {@inheritDoc} - */ + @Override public void openRepresentation(final Session openedSession, final DRepresentation representation) { try { new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()).run(false, false, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { DialectUIManager.INSTANCE.openEditor(openedSession, representation, monitor); } @@ -185,26 +166,20 @@ public abstract class AbstractSWTCallback implements UICallBack { } } - /** - * {@inheritDoc} - */ + @Override public Resource loadResource(final EditingDomain domain, final IFile file) { final LoadEMFResourceRunnableWithProgress operation = new LoadEMFResourceRunnableWithProgress(domain.getResourceSet(), file); try { operation.run(new NullProgressMonitor()); } catch (final InvocationTargetException e) { - SiriusTransPlugin.INSTANCE.error("error loading EMF resource", e); + SiriusTransPlugin.INSTANCE.error(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_loadResourceError, e); } catch (final InterruptedException e) { - SiriusTransPlugin.INSTANCE.error("error loading EMF resource", e); + SiriusTransPlugin.INSTANCE.error(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_loadResourceError, e); } return operation.getLoadedResource(); } - /** - * {@inheritDoc} - * - * @throws InterruptedException - */ + @Override public Collection<EObject> askForEObjects(String message, TreeItemWrapper input, AdapterFactory factory) throws InterruptedException { final EObjectSelectionWizard wizard = new EObjectSelectionWizard(EObjectSelectionWizard.WIZARD_GENERIC_DIALOG_TITLE, message, null, input, factory); wizard.setMany(true); @@ -216,11 +191,7 @@ public abstract class AbstractSWTCallback implements UICallBack { throw new InterruptedException(); } - /** - * {@inheritDoc} - * - * @throws InterruptedException - */ + @Override public EObject askForEObject(String message, TreeItemWrapper input, AdapterFactory factory) throws InterruptedException { final EObjectSelectionWizard wizard = new EObjectSelectionWizard(EObjectSelectionWizard.WIZARD_GENERIC_DIALOG_TITLE, message, null, input, factory); wizard.setMany(false); @@ -232,37 +203,27 @@ public abstract class AbstractSWTCallback implements UICallBack { throw new InterruptedException(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#shouldReload(Resource) - */ + @Override public boolean shouldReload(final Resource resource) { - return openQuestion("Reload the resource?", getCommonMessage(resource) + "externally changed, should we reload it?"); + return openQuestion(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_shouldReload_title, + MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_shouldReload_message, resource.getURI())); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#shouldRemove(Resource) - */ + @Override public boolean shouldRemove(final Resource resource) { - return openQuestion("Remove the resource?", getCommonMessage(resource) + "externally deleted, should we remove it and lose changes?"); + return openQuestion(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_shouldRemove_title, + MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_shouldRemove_message, resource.getURI())); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#shouldClose(Session, - * Resource) - */ + @Override public boolean shouldClose(final Session session, final Resource resource) { - return openQuestion("Close the representations file?", getCommonMessage(resource) + "deleted and contains critical data, should we close it?"); + return openQuestion(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_shouldClose_title, + MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_shouldClose_message, resource.getURI())); } /** * Convenience method to open a simple Yes/No question dialog. - * + * * @param title * the dialog's title, or <code>null</code> if none * @param message @@ -275,6 +236,7 @@ public abstract class AbstractSWTCallback implements UICallBack { return MessageDialog.openQuestion(getActiveShell(), title, message); } else { RunnableWithResult<Boolean> reload = new RunnableWithResult.Impl<Boolean>() { + @Override public void run() { setResult(MessageDialog.openQuestion(getActiveShell(), title, message)); } @@ -300,11 +262,12 @@ public abstract class AbstractSWTCallback implements UICallBack { * </UL> * <BR> * {@inheritDoc} - * + * * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#getSessionDisplayed(org.eclipse.sirius.business.api.session.Session) */ + @Override public String getSessionNameToDisplayWhileSaving(Session session) { - String name = ""; //$NON-NLS-1$ + String result = ""; //$NON-NLS-1$ if (session != null) { String projectName = null; Resource representationsFileResource = session.getSessionResource(); @@ -312,26 +275,39 @@ public abstract class AbstractSWTCallback implements UICallBack { if (representationsFileURI.segments().length > 1) { projectName = representationsFileURI.segment(1); } - if (ResourceSetSync.getStatus(representationsFileResource).equals(ResourceStatus.SYNC)) { - name = "Models"; + + final String location; + final boolean inProject; + URIQuery uriQuery = new URIQuery(representationsFileURI); + if (projectName != null) { + location = projectName; + inProject = true; } else { - if (semanticResourcesDirty(session)) { - name = "Models and Representations"; + location = uriQuery.isInMemoryURI() ? uriQuery.toPlatformString() : representationsFileURI.toString(); + inProject = false; + } + + if (ResourceSetSync.getStatus(representationsFileResource).equals(ResourceStatus.SYNC)) { + if (inProject) { + result = MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_modelsInProject, location); } else { - name = "Representations"; + result = MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_models, location); + } + } else if (semanticResourcesDirty(session)) { + if (inProject) { + result = MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_modelsAndRepresentationsInProject, location); + } else { + result = MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_modelsAndRepresentations, location); } - } - URIQuery uriQuery = new URIQuery(representationsFileURI); - if (projectName != null) { - name += " for project " + projectName; - } else if (uriQuery.isInMemoryURI()) { - name += " for \"" + uriQuery.toPlatformString() + "\""; } else { - name += " for \"" + representationsFileURI.toString() + "\""; + if (inProject) { + result = MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_representationsInProject, location); + } else { + result = MessageFormat.format(org.eclipse.sirius.viewpoint.provider.Messages.AbstractSWTCallback_representations, location); + } } } - - return name; + return result; } private boolean semanticResourcesDirty(Session session) { @@ -350,10 +326,6 @@ public abstract class AbstractSWTCallback implements UICallBack { return session.getSemanticResources(); } - private String getCommonMessage(final Resource resource) { - return "The " + resource.getURI() + " resource has been "; - } - private boolean inUIThread() { return Display.getCurrent() != null; } @@ -362,12 +334,7 @@ public abstract class AbstractSWTCallback implements UICallBack { return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.tools.api.command.ui.UICallBack#openError(java.lang.String, - * java.lang.String) - */ + @Override public void openError(String title, String message) { if (inUIThread()) { MessageDialog.openError(getActiveShell(), title, message); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusControlHandler.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusControlHandler.java index 31ecdfb440..265251c48e 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusControlHandler.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusControlHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -50,6 +50,7 @@ import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.ui.tools.internal.util.EMFCoreUtil; import org.eclipse.sirius.ui.tools.internal.wizards.SelectRepresentationsWizard; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; @@ -66,15 +67,13 @@ import com.google.common.collect.Sets; * Implements the UI part of the "Control" operation. This class gathers the * required parameters from the user and the invokes the properly configured * {@link org.eclipse.sirius.business.internal.command.control.ControlCommand} . - * + * * @since 0.9.0 - * + * * @author pcdavid */ public class SiriusControlHandler extends AbstractHandler { - /** - * {@inheritDoc} - */ + @Override public Object execute(final ExecutionEvent event) throws ExecutionException { final EObject semanticRoot = getSelectedEObject(event); if (semanticRoot != null) { @@ -84,7 +83,7 @@ public class SiriusControlHandler extends AbstractHandler { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { try { - monitor.beginTask("Control resources", 1); + monitor.beginTask(Messages.SiriusControlHandler_controlTask, 1); performControl(HandlerUtil.getActiveShell(event), semanticRoot, new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); @@ -105,7 +104,7 @@ public class SiriusControlHandler extends AbstractHandler { * Performs the control operation on the specified semantic element, using * the provided shell to interact with the end-user, gathering the required * parameters. - * + * * @param shell * the shell to use to interact with the user * @param semanticRoot @@ -148,7 +147,7 @@ public class SiriusControlHandler extends AbstractHandler { /** * Asks the user for the URI of the controlled resource to create. - * + * * @param shell * The shell to use to display the dialog * @param semanticRoot @@ -170,7 +169,7 @@ public class SiriusControlHandler extends AbstractHandler { /** * Creation of the dialog to ask the user for the URI of the controlled * resource to create. - * + * * @param shell * the shell to use to interact with the user. * @param defaultURI @@ -196,7 +195,7 @@ public class SiriusControlHandler extends AbstractHandler { /** * Finds the URI of the default corresponding Aird of a semantic model with * its URI. - * + * * @param semanticModelUri * URI of a semantic model * @return the URI of the default corresponding Aird @@ -209,7 +208,7 @@ public class SiriusControlHandler extends AbstractHandler { * Asks the end-user which representations should be controlled in * conjunction with the semantic elements. The default is to control all the * representations which target an element of the specified resource. - * + * * @param shell * the shell to use to interact with the user. * @param session @@ -229,7 +228,7 @@ public class SiriusControlHandler extends AbstractHandler { /** * Asks the end-user to select a sub-set of the representations existing in * the session. - * + * * @param shell * the shell to use to interact with the user. * @param session @@ -260,7 +259,7 @@ public class SiriusControlHandler extends AbstractHandler { * Returns all the existing representations in the given session which are * associated to a semantic element of the specified resource (excluding * elements of sub-resources). - * + * * @param session * the session opened for semanticRoot. * @param semanticRoot @@ -282,7 +281,7 @@ public class SiriusControlHandler extends AbstractHandler { * Returns the text of the URI proposed by default when controlling the * specified object. The URI is based on the initial parent resource and the * "name" feature of the controlled element. - * + * * @param obj * the controlled element. * @return the text of the URI. @@ -306,7 +305,7 @@ public class SiriusControlHandler extends AbstractHandler { private final String defaultURI; public ControlResourceDialog(final Shell parent, final String defaultURI) { - super(parent, EMFEditUIPlugin.INSTANCE.getString("_UI_ControlDialog_title"), SWT.SAVE); + super(parent, EMFEditUIPlugin.INSTANCE.getString("_UI_ControlDialog_title"), SWT.SAVE); //$NON-NLS-1$ this.defaultURI = defaultURI; } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusUncontrolHandler.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusUncontrolHandler.java index 1d6a9c4aee..b6b616aafd 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusUncontrolHandler.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/control/SiriusUncontrolHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -36,6 +36,7 @@ import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionEditorInput; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IReusableEditor; @@ -48,15 +49,13 @@ import org.eclipse.ui.handlers.HandlerUtil; * required parameters from the user and the invokes the properly configured * {@link org.eclipse.sirius.business.internal.command.control.UncontrolCommand} * . - * + * * @since 0.9.0 - * + * * @author pcdavid */ public class SiriusUncontrolHandler extends AbstractHandler { - /** - * {@inheritDoc} - */ + @Override public Object execute(final ExecutionEvent event) throws ExecutionException { final EObject semanticRoot = getSelectedEObject(event); if (semanticRoot != null) { @@ -66,7 +65,7 @@ public class SiriusUncontrolHandler extends AbstractHandler { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { try { - monitor.beginTask("Uncontrol resources", 1); + monitor.beginTask(Messages.SiriusUncontrolHandler_uncontrolTask, 1); performUncontrol(HandlerUtil.getActiveShell(event), semanticRoot, new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); @@ -85,7 +84,7 @@ public class SiriusUncontrolHandler extends AbstractHandler { /** * Performs the uncontrol operation. - * + * * @param shell * the shell to use to interact with users. * @param semanticRoot @@ -119,13 +118,13 @@ public class SiriusUncontrolHandler extends AbstractHandler { /** * Show dialog to uncontrol or not the representations. - * + * * @param shell * the shell to use to interact with users. * @return if the representations are uncontrolled */ protected boolean shouldUncontrolRepresentations(final Shell shell) { - return MessageDialog.openQuestion(shell, "Uncontrol representations?", "Do you want to uncontrol representations in addition to the semantic elements?"); + return MessageDialog.openQuestion(shell, Messages.SiriusUncontrolHandler_uncontrolRepresentationsTitle, Messages.SiriusUncontrolHandler_uncontrolRepresentationsMessage); } private EObject getSelectedEObject(final ExecutionEvent event) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/AbstractExportRepresentationsAsImagesDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/AbstractExportRepresentationsAsImagesDialog.java index f3d8a826c5..2197de1e9f 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/AbstractExportRepresentationsAsImagesDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/AbstractExportRepresentationsAsImagesDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -25,6 +25,7 @@ import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; import org.eclipse.sirius.ui.business.api.dialect.ExportFormat; import org.eclipse.sirius.ui.business.api.dialect.ExportFormat.ExportDocumentFormat; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -74,12 +75,12 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog /** * the image format label text. */ - protected static final String IMAGE_FORMAT_LABEL = "&Image Format:"; + protected static final String IMAGE_FORMAT_LABEL = Messages.AbstractExportRepresentationsAsImagesDialog_imageFormatLabel; /** * the browse button text. */ - protected static final String BROWSE_LABEL = "&Browse..."; + protected static final String BROWSE_LABEL = Messages.AbstractExportRepresentationsAsImagesDialog_browseLabel; /** * The id for the persistent image format setting for this dialog. @@ -89,27 +90,12 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog /** * an error access message. */ - protected static final String ACCES_ERROR_MESSAGE = "Access to path is impossible"; + protected static final String ACCES_ERROR_MESSAGE = Messages.AbstractExportRepresentationsAsImagesDialog_accessError; /** * an error folder not exist message. */ - protected static final String FOLDER_NOT_EXIST_MESSAGE = "Folder does not exist"; - - /** - * the browse button text. - */ - private static final String EXPORT_TO_HTML_LABEL = "Export to HTML"; - - /** - * an error message. - */ - private static final String FOLDER_BLANK_MESSAGE = "Folder cannot be blank"; - - /** - * an error message. - */ - private static final String FOLDER_INVALID_MESSAGE = "Folder is not a valid path"; + protected static final String FOLDER_NOT_EXIST_MESSAGE = Messages.AbstractExportRepresentationsAsImagesDialog_folderDoesNotExist; /** * The id for the persistent settings for this dialog. @@ -291,11 +277,6 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog */ protected abstract void saveDialogSettings(); - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ @Override protected void okPressed() { super.okPressed(); @@ -315,13 +296,13 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog if (folderText.getText().equals(EMPTY_STRING)) { - setDialogErrorState(FOLDER_BLANK_MESSAGE); + setDialogErrorState(Messages.AbstractExportRepresentationsAsImagesDialog_blankFolderError); } else { IPath path = new Path(EMPTY_STRING); if (!path.isValidPath(folderText.getText())) { - setDialogErrorState(FOLDER_INVALID_MESSAGE); + setDialogErrorState(Messages.AbstractExportRepresentationsAsImagesDialog_invalidFolderPathError); return; } @@ -371,11 +352,6 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog return items; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) - */ @Override protected Control createContents(Composite parent) { Control result = super.createContents(parent); @@ -383,12 +359,6 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog return result; } - /** - * {@inheritDoc} Creates and returns the contents of the upper part of this - * dialog (above the button bar). - * - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ @Override protected Control createDialogArea(final Composite parent) { final Composite composite = (Composite) super.createDialogArea(parent); @@ -445,7 +415,7 @@ public abstract class AbstractExportRepresentationsAsImagesDialog extends Dialog Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 1, false); exportToHTMLCheckbox = new Button(composite, SWT.CHECK | SWT.LEFT); - exportToHTMLCheckbox.setText(EXPORT_TO_HTML_LABEL); + exportToHTMLCheckbox.setText(Messages.AbstractExportRepresentationsAsImagesDialog_htmlExport); GridData data = new GridData(GridData.FILL_HORIZONTAL); exportToHTMLCheckbox.setLayoutData(data); exportToHTMLCheckbox.setSelection(exportToHTML); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportOneRepresentationAsImageDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportOneRepresentationAsImageDialog.java index cb7b3f22c0..5620e1094b 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportOneRepresentationAsImageDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportOneRepresentationAsImageDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.sirius.common.tools.api.resource.ImageFileFormat; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; @@ -37,9 +38,9 @@ import org.eclipse.swt.widgets.Shell; /** * Dialog used by the export one diagram to image files action to prompt the * user for a destination and image format. - * + * * @author jdupont - * + * */ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresentationsAsImagesDialog { @@ -49,38 +50,13 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen private static final String DIALOG_SETTINGS_FILE = "ExportRepresentationsAsImagesDialog.file"; //$NON-NLS-1$ /** - * Invalid path error message. - */ - private static final String INVALID_PATH_MESSAGE = "Invalid path"; - - /** - * Invalid path error message. - */ - private static final String INVALID_FILE_PATH_MESSAGE = "Invalid file path"; - - /** - * File path name field. - */ - private static final String TO_FILE = "To file"; - - /** - * Popup dialog name export file. - */ - private static final String EXPORT_TO_IMAGE = "Export to Image"; - - /** - * the dialog window title. - */ - private static final String DIALOG_TITLE = "Export representation as image file"; - - /** * file name to export. */ private String fileName; /** * Creates an instance of the copy to image dialog. - * + * * @param shell * the parent shell * @param path @@ -94,17 +70,11 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen initDialogSettings(path); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#handleBrowseButtonPressed() - */ @Override protected void handleBrowseButtonPressed() { final FileDialog dialog = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE); - dialog.setFilterExtensions(new String[] { "*.png;*.jpg;*.svg", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ - dialog.setText(EXPORT_TO_IMAGE); + dialog.setFilterExtensions(new String[] { "*.png;*.jpg;*.svg", "*.*" }); //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setText(Messages.ExportOneRepresentationAsImageDialog_exportToImage); String currentSourceString = folderText.getText(); File file = new File(folderText.getText()); if (file.isFile()) { @@ -124,16 +94,10 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#createImageFormatGroup(org.eclipse.swt.widgets.Composite) - */ @Override protected void createImageFormatGroup(final Composite parent) { final Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 3, false); - SWTUtil.createLabel(composite, IMAGE_FORMAT_LABEL); + SWTUtil.createLabel(composite, AbstractExportRepresentationsAsImagesDialog.IMAGE_FORMAT_LABEL); String[] imageSafeFormatItems = getImageSafeFormatItems(); @@ -150,29 +114,23 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen imageFormatControl = imageFormatCombo; } } else { - imageFormatControl = SWTUtil.createLabel(composite, DEFAULT_VALUE.getName()); + imageFormatControl = SWTUtil.createLabel(composite, AbstractExportRepresentationsAsImagesDialog.DEFAULT_VALUE.getName()); } final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); imageFormatControl.setLayoutData(gridData); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#createFolderGroup(org.eclipse.swt.widgets.Composite) - */ @Override protected void createFolderGroup(final Composite parent) { final Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 4, false); - SWTUtil.createLabel(composite, TO_FILE); + SWTUtil.createLabel(composite, Messages.ExportOneRepresentationAsImageDialog_toFile); folderText = new Combo(composite, SWT.SINGLE | SWT.BORDER); restoreWidgetValues(); IPath path = new Path(folder); if (isExistingFolder(path) || path.getFileExtension() == null) { path = path.addTrailingSeparator(); - path = path.append(fileName.replaceAll("[/\\\\]", FILE_SEPARATOR_ALTERNATIVE)); //$NON-NLS-1$ + path = path.append(fileName.replaceAll("[/\\\\]", AbstractExportRepresentationsAsImagesDialog.FILE_SEPARATOR_ALTERNATIVE)); //$NON-NLS-1$ String extension = imageFormat.getName().toLowerCase(); path = path.addFileExtension(extension); String newExtensionFilePath = path.toFile().getPath(); @@ -183,7 +141,7 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen gridData.widthHint = 350; folderText.setLayoutData(gridData); final Button button = new Button(composite, SWT.PUSH); - button.setText(BROWSE_LABEL); + button.setText(AbstractExportRepresentationsAsImagesDialog.BROWSE_LABEL); button.setLayoutData(AbstractExportRepresentationsAsImagesDialog.makeButtonData(button)); button.addSelectionListener(new SelectionAdapter() { @Override @@ -196,26 +154,20 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen /** * {@inheritDoc} Configures the shell in preparation for opening this window * in it. - * + * * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @Override protected void configureShell(final Shell shell) { super.configureShell(shell); - shell.setText(DIALOG_TITLE); + shell.setText(Messages.ExportOneRepresentationAsImageDialog_dialogTitle); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#restoreWidgetValues() - */ @Override protected void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { - String[] directoryNames = settings.getArray(DIALOG_SETTINGS_FILE); + String[] directoryNames = settings.getArray(ExportOneRepresentationAsImageDialog.DIALOG_SETTINGS_FILE); if (directoryNames == null || directoryNames.length == 0) { return; // ie.- no settings stored } @@ -227,12 +179,6 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#initDialogSettings(org.eclipse.core.runtime.IPath) - */ @Override protected void initDialogSettings(final IPath path) { final IDialogSettings dialogSettings = getDialogSettings(); @@ -242,7 +188,7 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen folder = "/"; //$NON-NLS-1$ if (path == null) { - final String persistentFolder = dialogSettings.get(DIALOG_SETTINGS_FILE); + final String persistentFolder = dialogSettings.get(ExportOneRepresentationAsImageDialog.DIALOG_SETTINGS_FILE); if (persistentFolder != null) { folder = persistentFolder; } @@ -250,7 +196,7 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen folder = path.toOSString(); } - final String persistentImageFormat = dialogSettings.get(DIALOG_SETTINGS_IMAGE_FORMAT); + final String persistentImageFormat = dialogSettings.get(AbstractExportRepresentationsAsImagesDialog.DIALOG_SETTINGS_IMAGE_FORMAT); if (persistentImageFormat == null) { imageFormat = AbstractExportRepresentationsAsImagesDialog.getDefaultImageFormat(); } else { @@ -259,17 +205,11 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#saveDialogSettings() - */ @Override protected void saveDialogSettings() { final IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { - String[] directoryNames = dialogSettings.getArray(DIALOG_SETTINGS_FILE); + String[] directoryNames = dialogSettings.getArray(ExportOneRepresentationAsImageDialog.DIALOG_SETTINGS_FILE); if (directoryNames == null || directoryNames.length == 0) { directoryNames = new String[1]; directoryNames[0] = folder; @@ -282,17 +222,11 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen } directoryNames = addToHistory(directoryNames, folderPathToKeepInHistory); - dialogSettings.put(DIALOG_SETTINGS_FILE, directoryNames); - dialogSettings.put(DIALOG_SETTINGS_IMAGE_FORMAT, imageFormat.getName()); + dialogSettings.put(ExportOneRepresentationAsImageDialog.DIALOG_SETTINGS_FILE, directoryNames); + dialogSettings.put(AbstractExportRepresentationsAsImagesDialog.DIALOG_SETTINGS_IMAGE_FORMAT, imageFormat.getName()); } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#validateFolderText() - */ @Override protected void validateFolderText() { super.validateFolderText(); @@ -301,17 +235,17 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen final IPath path = new Path(folderText.getText()); if (file.isDirectory()) { - setDialogErrorState(INVALID_FILE_PATH_MESSAGE); + setDialogErrorState(Messages.ExportOneRepresentationAsImageDialog_invalidFilePath); } else { // If the name of file is not informed in export one // representation, the extension is add to path if (directory == null) { - setDialogErrorState(INVALID_PATH_MESSAGE); + setDialogErrorState(Messages.ExportOneRepresentationAsImageDialog_invalidPath); } else if (!directory.exists()) { - setDialogErrorState(FOLDER_NOT_EXIST_MESSAGE); - } else if (path.toString().endsWith("/") || path.toString().endsWith(CHARACTER_EXTENSION_FILE)) { //$NON-NLS-1$ - setDialogErrorState(INVALID_PATH_MESSAGE); + setDialogErrorState(AbstractExportRepresentationsAsImagesDialog.FOLDER_NOT_EXIST_MESSAGE); + } else if (path.toString().endsWith("/") || path.toString().endsWith(AbstractExportRepresentationsAsImagesDialog.CHARACTER_EXTENSION_FILE)) { //$NON-NLS-1$ + setDialogErrorState(Messages.ExportOneRepresentationAsImageDialog_invalidPath); } } @@ -329,33 +263,33 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen path = path.append(fileName); } // Add the file extension if needed - if (!path.toString().endsWith(CHARACTER_EXTENSION_FILE) && path.getFileExtension() == null) { + if (!path.toString().endsWith(AbstractExportRepresentationsAsImagesDialog.CHARACTER_EXTENSION_FILE) && path.getFileExtension() == null) { path = path.addFileExtension(imageFormatCombo.getText().toLowerCase()); folderText.setText(path.toOSString()); } changeComboImageFormat(); } - @SuppressWarnings("static-access") private void changeComboImageFormat() { IPath path = new Path(folderText.getText()); - if (!isExistingFolder(path) && !path.toString().endsWith(CHARACTER_EXTENSION_FILE)) { + if (!isExistingFolder(path) && !path.toString().endsWith(AbstractExportRepresentationsAsImagesDialog.CHARACTER_EXTENSION_FILE)) { String fileExtension = path.getFileExtension(); if (fileExtension != null) { boolean isPresent = false; - for (ImageFileFormat extension : SAFE_VALUES) { + for (ImageFileFormat extension : AbstractExportRepresentationsAsImagesDialog.SAFE_VALUES) { if (extension.getName().toLowerCase().equals(fileExtension.toLowerCase())) { imageFormatCombo.setText(extension.getName()); isPresent = true; break; } else if ("jpeg".equals(fileExtension.toLowerCase())) { //$NON-NLS-1$ - imageFormatCombo.setText(imageFormat.JPG.getName()); + imageFormatCombo.setText(ImageFileFormat.JPG.getName()); isPresent = true; break; } } if (!isPresent) { - StringBuffer fileWithExtensionForbidden = new StringBuffer(folderText.getText()).append(CHARACTER_EXTENSION_FILE).append(imageFormatCombo.getText().toLowerCase()); + StringBuffer fileWithExtensionForbidden = new StringBuffer(folderText.getText()).append(AbstractExportRepresentationsAsImagesDialog.CHARACTER_EXTENSION_FILE).append( + imageFormatCombo.getText().toLowerCase()); folderText.setText(fileWithExtensionForbidden.toString()); } } @@ -363,21 +297,18 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#initListeners() - */ @Override protected void initListeners() { changeComboImageFormat(); folderText.addModifyListener(new ModifyListener() { + @Override public void modifyText(final ModifyEvent e) { validateFolderText(); } }); folderText.addSelectionListener(new SelectionListener() { + @Override public void widgetSelected(SelectionEvent e) { final File file = new File(folderText.getText()); if (file.isDirectory()) { @@ -385,22 +316,25 @@ public class ExportOneRepresentationAsImageDialog extends AbstractExportRepresen } } + @Override public void widgetDefaultSelected(SelectionEvent e) { // Do nothing. } }); folderText.addFocusListener(new FocusListener() { + @Override public void focusLost(FocusEvent e) { IPath path = new Path(folderText.getText()); // Add the file extension if needed - if (!path.toString().endsWith(CHARACTER_EXTENSION_FILE) && path.getFileExtension() == null) { + if (!path.toString().endsWith(AbstractExportRepresentationsAsImagesDialog.CHARACTER_EXTENSION_FILE) && path.getFileExtension() == null) { path = path.addFileExtension(imageFormatCombo.getText().toLowerCase()); folderText.setText(path.toOSString()); } changeComboImageFormat(); } + @Override public void focusGained(FocusEvent e) { } }); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportSeveralRepresentationsAsImagesDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportSeveralRepresentationsAsImagesDialog.java index 1f68b4677f..89f0252fe1 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportSeveralRepresentationsAsImagesDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/dialogs/ExportSeveralRepresentationsAsImagesDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -33,9 +34,9 @@ import org.eclipse.swt.widgets.Shell; /** * Dialog used by the export several diagrams to image files action to prompt * the user for a destination and image format. - * + * * @author jdupont - * + * */ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRepresentationsAsImagesDialog { @@ -47,26 +48,26 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe /** * the directory dialog message. */ - private static final String DIRECTORY_DIALOG_MESSAGE = "Select the destination folder"; + private static final String DIRECTORY_DIALOG_MESSAGE = Messages.ExportSeveralRepresentationsAsImagesDialog_dialogMessage; /** * the directory dialog text. */ - private static final String DIRECTORY_DIALOG_TEXT = DIRECTORY_DIALOG_MESSAGE; + private static final String DIRECTORY_DIALOG_TEXT = ExportSeveralRepresentationsAsImagesDialog.DIRECTORY_DIALOG_MESSAGE; /** * Popup file field label. */ - private static final String TO_DIRECTORY = "To directory"; + private static final String TO_DIRECTORY = Messages.ExportSeveralRepresentationsAsImagesDialog_toDirectory; /** * the dialog window title. */ - private static final String DIALOG_TITLE = "Export representations as image file"; + private static final String DIALOG_TITLE = Messages.ExportSeveralRepresentationsAsImagesDialog_dialogTitle; /** * Creates an instance of the copy to image dialog. - * + * * @param shell * the parent shell * @param path @@ -77,17 +78,14 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe initDialogSettings(path); } - /** - * {@inheritDoc} - */ @Override protected void handleBrowseButtonPressed() { final DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell()); - dialog.setMessage(DIRECTORY_DIALOG_MESSAGE); - dialog.setText(DIRECTORY_DIALOG_TEXT); + dialog.setMessage(ExportSeveralRepresentationsAsImagesDialog.DIRECTORY_DIALOG_MESSAGE); + dialog.setText(ExportSeveralRepresentationsAsImagesDialog.DIRECTORY_DIALOG_TEXT); final String dirName = folderText.getText(); - if (!dirName.equals(EMPTY_STRING)) { + if (!dirName.equals(AbstractExportRepresentationsAsImagesDialog.EMPTY_STRING)) { final File path = new File(dirName); if (path.exists()) { dialog.setFilterPath(new Path(dirName).toOSString()); @@ -100,13 +98,10 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe } } - /** - * {@inheritDoc} - */ @Override protected void createFolderGroup(final Composite parent) { final Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 4, false); - SWTUtil.createLabel(composite, TO_DIRECTORY); + SWTUtil.createLabel(composite, ExportSeveralRepresentationsAsImagesDialog.TO_DIRECTORY); folderText = new Combo(composite, SWT.SINGLE | SWT.BORDER); restoreWidgetValues(); @@ -116,7 +111,7 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe folderText.setLayoutData(gridData); final Button button = new Button(composite, SWT.PUSH); - button.setText(BROWSE_LABEL); + button.setText(AbstractExportRepresentationsAsImagesDialog.BROWSE_LABEL); button.setLayoutData(AbstractExportRepresentationsAsImagesDialog.makeButtonData(button)); button.addSelectionListener(new SelectionAdapter() { @Override @@ -126,16 +121,10 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe }); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#createImageFormatGroup(org.eclipse.swt.widgets.Composite) - */ @Override protected void createImageFormatGroup(final Composite parent) { final Composite composite = SWTUtil.createCompositeHorizontalFill(parent, 3, false); - SWTUtil.createLabel(composite, IMAGE_FORMAT_LABEL); + SWTUtil.createLabel(composite, AbstractExportRepresentationsAsImagesDialog.IMAGE_FORMAT_LABEL); String[] imageSafeFormatItems = getImageSafeFormatItems(); @@ -152,7 +141,7 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe imageFormatControl = imageFormatCombo; } } else { - imageFormatControl = SWTUtil.createLabel(composite, DEFAULT_VALUE.getName()); + imageFormatControl = SWTUtil.createLabel(composite, AbstractExportRepresentationsAsImagesDialog.DEFAULT_VALUE.getName()); } final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); imageFormatControl.setLayoutData(gridData); @@ -162,26 +151,20 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe /** * {@inheritDoc} Configures the shell in preparation for opening this window * in it. - * + * * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ @Override protected void configureShell(final Shell shell) { super.configureShell(shell); - shell.setText(DIALOG_TITLE); + shell.setText(ExportSeveralRepresentationsAsImagesDialog.DIALOG_TITLE); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#restoreWidgetValues() - */ @Override protected void restoreWidgetValues() { IDialogSettings settings = getDialogSettings(); if (settings != null) { - String[] directoryNames = settings.getArray(DIALOG_SETTINGS_FOLDER); + String[] directoryNames = settings.getArray(ExportSeveralRepresentationsAsImagesDialog.DIALOG_SETTINGS_FOLDER); if (directoryNames == null || directoryNames.length == 0) { return; // ie.- no settings stored } @@ -193,12 +176,6 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#initDialogSettings(org.eclipse.core.runtime.IPath) - */ @Override protected void initDialogSettings(final IPath path) { final IDialogSettings dialogSettings = getDialogSettings(); @@ -208,7 +185,7 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe folder = "/"; //$NON-NLS-1$ if (path == null) { - final String persistentFolder = dialogSettings.get(DIALOG_SETTINGS_FOLDER); + final String persistentFolder = dialogSettings.get(ExportSeveralRepresentationsAsImagesDialog.DIALOG_SETTINGS_FOLDER); if (persistentFolder != null) { folder = persistentFolder; } @@ -216,7 +193,7 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe folder = path.toOSString(); } - final String persistentImageFormat = dialogSettings.get(DIALOG_SETTINGS_IMAGE_FORMAT); + final String persistentImageFormat = dialogSettings.get(AbstractExportRepresentationsAsImagesDialog.DIALOG_SETTINGS_IMAGE_FORMAT); if (persistentImageFormat == null) { imageFormat = AbstractExportRepresentationsAsImagesDialog.getDefaultImageFormat(); } else { @@ -224,53 +201,37 @@ public class ExportSeveralRepresentationsAsImagesDialog extends AbstractExportRe } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#saveDialogSettings() - */ @Override protected void saveDialogSettings() { final IDialogSettings dialogSettings = getDialogSettings(); if (dialogSettings != null) { - String[] directoryNames = dialogSettings.getArray(DIALOG_SETTINGS_FOLDER); + String[] directoryNames = dialogSettings.getArray(ExportSeveralRepresentationsAsImagesDialog.DIALOG_SETTINGS_FOLDER); if (directoryNames == null || directoryNames.length == 0) { directoryNames = new String[1]; directoryNames[0] = folder; } directoryNames = addToHistory(directoryNames, folder); - dialogSettings.put(DIALOG_SETTINGS_FOLDER, directoryNames); - dialogSettings.put(DIALOG_SETTINGS_IMAGE_FORMAT, imageFormat.getName()); + dialogSettings.put(ExportSeveralRepresentationsAsImagesDialog.DIALOG_SETTINGS_FOLDER, directoryNames); + dialogSettings.put(AbstractExportRepresentationsAsImagesDialog.DIALOG_SETTINGS_IMAGE_FORMAT, imageFormat.getName()); } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#validateFolderText() - */ @Override protected void validateFolderText() { super.validateFolderText(); final File file = new File(folderText.getText()); - + if (!file.exists()) { - setDialogErrorState(FOLDER_NOT_EXIST_MESSAGE); + setDialogErrorState(AbstractExportRepresentationsAsImagesDialog.FOLDER_NOT_EXIST_MESSAGE); return; } } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsImagesDialog#initListeners() - */ @Override protected void initListeners() { folderText.addModifyListener(new ModifyListener() { + @Override public void modifyText(final ModifyEvent e) { validateFolderText(); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/profiler/SiriusTasks.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/profiler/SiriusTasks.java index 09f941e598..30ccca6580 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/profiler/SiriusTasks.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/profiler/SiriusTasks.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -318,7 +318,7 @@ public final class SiriusTasks { /** * When collapsing or expanding a line of the table. */ - public static final ProfilerTask CHANGE_SWT_LINE_COLAPSE_STATE = new ProfilerTask(SiriusTasksKey.SWT_CAT, "Change the collapse state of a line of the SWT table", getImagePath(IMAGES_SWT)); + public static final ProfilerTask CHANGE_SWT_LINE_COLAPSE_STATE = new ProfilerTask(SiriusTasksKey.SWT_CAT, SiriusTasksKey.CHANGE_SWT_LINE_COLLAPSE_STATE_KEY, getImagePath(IMAGES_SWT)); /** * When refreshing a line of the table. diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/project/ViewpointSpecificationProject.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/project/ViewpointSpecificationProject.java index 37fc7b6347..0995c2f019 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/project/ViewpointSpecificationProject.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/project/ViewpointSpecificationProject.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -81,12 +81,12 @@ import org.eclipse.ui.part.ISetSelectionTarget; public final class ViewpointSpecificationProject { /** The extension use for viewpoint model. */ - public static final String VIEWPOINT_MODEL_EXTENSION = SiriusEditPlugin.getPlugin().getString("_UI_SiriusEditorFilenameExtension"); + public static final String VIEWPOINT_MODEL_EXTENSION = SiriusEditPlugin.INSTANCE.getString("_UI_SiriusEditorFilenameExtension"); //$NON-NLS-1$ /** * The default initial object name for a odesign. */ - public static final String INITIAL_OBJECT_NAME = "Group"; + public static final String INITIAL_OBJECT_NAME = DescriptionPackage.Literals.GROUP.getName(); /** * The default encoding. @@ -301,7 +301,7 @@ public final class ViewpointSpecificationProject { try { activePage.openEditor(new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); } catch (final PartInitException exception) { - MessageDialog.openError(ViewpointSpecificationProject.getShell(), SiriusEditPlugin.getPlugin().getString("_UI_OpenEditorError_label"), exception.getMessage()); + MessageDialog.openError(ViewpointSpecificationProject.getShell(), SiriusEditPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); //$NON-NLS-1$ } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractCompositeEObjectPropertySource.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractCompositeEObjectPropertySource.java index 839250078a..855d8f21e4 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractCompositeEObjectPropertySource.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/properties/AbstractCompositeEObjectPropertySource.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -31,6 +31,7 @@ import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuthority; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.views.properties.IPropertyDescriptor; import org.eclipse.ui.views.properties.IPropertySource; @@ -85,20 +86,12 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert } } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue() - */ + @Override public Object getEditableValue() { return this.propertySources; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() - */ + @Override public IPropertyDescriptor[] getPropertyDescriptors() { final List<IPropertyDescriptor> propertyDescriptors = new LinkedList<IPropertyDescriptor>(); final Iterator<Entry<EObjectIndexer, IPropertySource>> iterPropertySourcesEntries = this.propertySources.entrySet().iterator(); @@ -133,42 +126,25 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return descriptorsList; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) - */ + @Override public Object getPropertyValue(final Object id) { final Identifier identifier = (Identifier) id; return getPropertySource(identifier).getPropertyValue(identifier.getId()); } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object) - */ + @Override public boolean isPropertySet(final Object id) { final Identifier identifier = (Identifier) id; return getPropertySource(identifier).isPropertySet(identifier.getId()); } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object) - */ + @Override public void resetPropertyValue(final Object id) { final Identifier identifier = (Identifier) id; getPropertySource(identifier).resetPropertyValue(identifier.getId()); } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, - * java.lang.Object) - */ + @Override public void setPropertyValue(final Object id, final Object value) { final Identifier identifier = (Identifier) id; getPropertySource(identifier).setPropertyValue(identifier.getId(), value); @@ -261,23 +237,13 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert */ private Identifier identifier; - /** - * - * @param decorated - * @param category - * @param eObject - */ public PropertyDescriptorDecorator(final IPropertyDescriptor decorated, final String category, final EObject eObject) { this.category = category; this.decorated = decorated; this.identifier = new Identifier(eObject, this.decorated.getId()); } - /** - * @param parent - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#createPropertyEditor(org.eclipse.swt.widgets.Composite) - */ + @Override public CellEditor createPropertyEditor(final Composite parent) { CellEditor cellEditor = null; if (getPermissionAuthority().canEditInstance(identifier.getEObject())) { @@ -291,67 +257,42 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return accessor.getPermissionAuthority(); } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getCategory() - */ + @Override public String getCategory() { return this.category; } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getDescription() - */ + @Override public String getDescription() { return decorated.getDescription(); } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getDisplayName() - */ + @Override public String getDisplayName() { return decorated.getDisplayName(); } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getFilterFlags() - */ + @Override public String[] getFilterFlags() { return decorated.getFilterFlags(); } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getHelpContextIds() - */ + @Override public Object getHelpContextIds() { return decorated.getHelpContextIds(); } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getId() - */ + @Override public Object getId() { return this.identifier; } - /** - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#getLabelProvider() - */ + @Override public ILabelProvider getLabelProvider() { return decorated.getLabelProvider(); } - /** - * @param anotherProperty - * @return - * @see org.eclipse.ui.views.properties.IPropertyDescriptor#isCompatibleWith(org.eclipse.ui.views.properties.IPropertyDescriptor) - */ + @Override public boolean isCompatibleWith(final IPropertyDescriptor anotherProperty) { return decorated.isCompatibleWith(anotherProperty); } @@ -378,10 +319,10 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert */ public Identifier(final EObject eObject, final Object id) { if (eObject == null) { - throw new IllegalArgumentException("eObject is null"); + throw new IllegalArgumentException(Messages.AbstractCompositeEObjectPropertySource_missingEObject); } if (id == null) { - throw new IllegalArgumentException("id is null"); + throw new IllegalArgumentException(Messages.AbstractCompositeEObjectPropertySource_missingId); } this.eObject = eObject; this.id = id; @@ -405,11 +346,6 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return id; } - /** - * {@inheritDoc} - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { if (obj instanceof Identifier) { @@ -419,11 +355,6 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return false; } - /** - * {@inheritDoc} - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { return this.eObject.hashCode(); @@ -449,16 +380,12 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert this.propertySources.add(propertySource); } - /** - * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue() - */ + @Override public Object getEditableValue() { return this.propertySources; } - /** - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() - */ + @Override public IPropertyDescriptor[] getPropertyDescriptors() { final List<IPropertyDescriptor> propertyDescriptors = new LinkedList<IPropertyDescriptor>(); final Iterator<IPropertySource> iterPropertySources = this.propertySources.iterator(); @@ -469,9 +396,7 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return propertyDescriptors.toArray(new IPropertyDescriptor[propertyDescriptors.size()]); } - /** - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) - */ + @Override public Object getPropertyValue(final Object id) { final IPropertySource propertySource = getPropertySourceFor(id); if (propertySource != null) { @@ -480,9 +405,7 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return null; } - /** - * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object) - */ + @Override public boolean isPropertySet(final Object id) { final IPropertySource propertySource = getPropertySourceFor(id); if (propertySource != null) { @@ -491,9 +414,7 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert return false; } - /** - * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object) - */ + @Override public void resetPropertyValue(final Object id) { final IPropertySource propertySource = getPropertySourceFor(id); if (propertySource != null) { @@ -501,10 +422,7 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert } } - /** - * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, - * java.lang.Object) - */ + @Override public void setPropertyValue(final Object id, final Object value) { final IPropertySource propertySource = getPropertySourceFor(id); if (propertySource != null) { @@ -560,31 +478,17 @@ public abstract class AbstractCompositeEObjectPropertySource implements IPropert this.eObject = eObject; } - /** - * {@inheritDoc} - * - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ + @Override public int compareTo(final Object o) { final EObjectIndexer eObjectIndexer = (EObjectIndexer) o; return this.index - eObjectIndexer.index; } - /** - * {@inheritDoc} - * - * @see java.lang.Object#hashCode() - */ @Override public int hashCode() { return this.index; } - /** - * {@inheritDoc} - * - * @see java.lang.Object#equals(java.lang.Object) - */ @Override public boolean equals(final Object obj) { boolean result = false; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/provider/DTableLabelProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/provider/DTableLabelProvider.java index 18ca2f97af..2189fd0148 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/provider/DTableLabelProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/provider/DTableLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008, 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.api.provider; +import java.text.MessageFormat; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -25,9 +26,11 @@ import org.eclipse.sirius.common.ui.business.api.views.properties.tabbed.LabelPr import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.ui.tools.internal.editor.AbstractDTreeEditor; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.IEditorPart; +import com.google.common.base.Joiner; import com.google.common.collect.Lists; /** @@ -53,11 +56,6 @@ public class DTableLabelProvider extends LabelProvider { labelProviderProviderService = new LabelProviderProviderService(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ @Override public Image getImage(final Object object) { Image labelImage = null; @@ -82,11 +80,6 @@ public class DTableLabelProvider extends LabelProvider { return labelImage; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ @Override public String getText(final Object object) { String text = null; @@ -103,7 +96,7 @@ public class DTableLabelProvider extends LabelProvider { semanticSelection = extractSemanticSelection(((IStructuredSelection) object).toList()); selectionSize = semanticSelection.size(); if (containsDifferentTypes(semanticSelection)) { - text = selectionSize + " items selected"; //$NON-NLS-1$ + text = MessageFormat.format(Messages.DTableLabelProvider_nbSelectedItems, selectionSize); } else if (!semanticSelection.isEmpty()) { tempObject = semanticSelection.iterator().next(); } @@ -115,15 +108,11 @@ public class DTableLabelProvider extends LabelProvider { } if (selectionSize > 1) { - text = selectionSize + " ["; - final Iterator<?> iterator = semanticSelection.iterator(); - while (iterator.hasNext()) { - text += getAdapterFactoryLabelProvider().getText(iterator.next()); - if (iterator.hasNext()) { - text += ", "; - } + List<String> labels = Lists.newArrayList(); + for (Object selected : semanticSelection) { + labels.add(getAdapterFactoryLabelProvider().getText(selected)); } - text += "] selected"; + text = MessageFormat.format(Messages.DTableLabelProvider_selectedItemsList, selectionSize, Joiner.on(", ").join(labels)); //$NON-NLS-1$ } } return text; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/RefreshLabelImageJob.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/RefreshLabelImageJob.java index 0e2534186e..cb9dc36e52 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/RefreshLabelImageJob.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/RefreshLabelImageJob.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.viewers.IBasicPropertyConstants; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.navigator.CommonNavigator; import org.eclipse.ui.navigator.CommonViewer; import org.eclipse.ui.progress.UIJob; @@ -24,7 +25,7 @@ import org.eclipse.ui.progress.UIJob; /** * A {@link UIJob} to refresh the image of the label in a * {@link CommonNavigator}. - * + * * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> */ public class RefreshLabelImageJob extends UIJob { @@ -50,21 +51,21 @@ public class RefreshLabelImageJob extends UIJob { /** * Default constructor. - * + * * @param view * the view to refresh * @param elementsToRefresh * the element for which refresh TreeItem in the Model explorer */ public RefreshLabelImageJob(CommonNavigator view, Collection<Object> elementsToRefresh) { - super("Refreshing lock decorations"); + super(Messages.RefreshLabelImageJob_name); this.view = view; this.elementsToRefresh = elementsToRefresh; } /** * Refreshes the lock decorations of the model explorer view. - * + * * {@inheritDoc} */ @Override @@ -86,7 +87,7 @@ public class RefreshLabelImageJob extends UIJob { /** * Returns the elements that this job is in charge of refreshing. - * + * * @return the elements that this job is in charge of refreshing */ public Collection<?> getElementsToRefresh() { @@ -95,6 +96,6 @@ public class RefreshLabelImageJob extends UIJob { @Override public boolean belongsTo(Object family) { - return FAMILY.equals(family); + return RefreshLabelImageJob.FAMILY.equals(family); } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/MarkerDeletionJob.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/MarkerDeletionJob.java index a61ab7ef40..42613822b2 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/MarkerDeletionJob.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/views/modelexplorerview/resourcelistener/MarkerDeletionJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES 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 @@ -18,10 +18,11 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.sirius.business.internal.modelingproject.marker.ModelingMarker; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * A {@link WorkspaceJob} to delete markers of a {@link IResource}. - * + * * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> */ public class MarkerDeletionJob extends WorkspaceJob { @@ -30,18 +31,16 @@ public class MarkerDeletionJob extends WorkspaceJob { /** * Default constructor. - * + * * @param resource * the {@link IResource} for which to delete markers */ public MarkerDeletionJob(IResource resource) { - super("Remove modeling marker"); + super(Messages.MarkerDeletionJob_name); this.resource = resource; } - /** - * {@inheritDoc} - */ + @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { resource.deleteMarkers(ModelingMarker.MARKER_TYPE, false, IResource.DEPTH_ZERO); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/wizards/page/ViewpointsSelectionWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/wizards/page/ViewpointsSelectionWizardPage.java index 7caee6fe03..42ca6bde30 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/wizards/page/ViewpointsSelectionWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/wizards/page/ViewpointsSelectionWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -58,6 +58,7 @@ import org.eclipse.sirius.common.tools.api.util.StringUtil; import org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelection; import org.eclipse.sirius.ui.tools.api.views.ViewHelper; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTError; @@ -78,16 +79,11 @@ import com.google.common.collect.Sets; /** * A wizard page to select viewpoints. - * + * * @author mchauvin */ public class ViewpointsSelectionWizardPage extends WizardPage { - /** The title of the page. */ - private static final String PAGE_TITLE = "Select viewpoints"; - - private static final String PAGE_MESSAGE = "Select viewpoints to activate"; - /** The table viewer. */ private TableViewer tableViewer; @@ -114,14 +110,14 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /** * Create a new <code>RepresentationSelectionWizardPage</code>. - * + * * @param session * the session */ public ViewpointsSelectionWizardPage(final Session session) { - super(PAGE_TITLE); - this.setTitle(PAGE_TITLE); - this.setMessage(PAGE_MESSAGE); + super(Messages.ViewpointsSelectionWizardPage_title); + this.setTitle(Messages.ViewpointsSelectionWizardPage_title); + this.setMessage(Messages.ViewpointsSelectionWizardPage_message); this.fileExtensions = computeSemanticFileExtensions(session); this.viewpoints = Lists.newArrayList(); this.viewpointsNamesToActivateByDefault = Lists.newArrayList(); @@ -130,16 +126,16 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /** * Create a new <code>RepresentationSelectionWizardPage</code> with default * viewpoints activation. This constructor makes this page optional. - * + * * @param session * the session * @param viewpointsNamesToActivateByDefault * list of viewpoints names to activate by default. */ public ViewpointsSelectionWizardPage(final Session session, List<String> viewpointsNamesToActivateByDefault) { - super(PAGE_TITLE); - this.setTitle(PAGE_TITLE); - this.setMessage(PAGE_MESSAGE); + super(Messages.ViewpointsSelectionWizardPage_title); + this.setTitle(Messages.ViewpointsSelectionWizardPage_title); + this.setMessage(Messages.ViewpointsSelectionWizardPage_message); this.fileExtensions = computeSemanticFileExtensions(session); this.viewpoints = Lists.newArrayList(); this.viewpointsNamesToActivateByDefault = Lists.newArrayList(viewpointsNamesToActivateByDefault); @@ -148,7 +144,7 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /** * compute the semantic file extensions to restrict the choice of viewpoint * based on the session. - * + * * @param session * the session * @return a collection of file extension @@ -166,11 +162,6 @@ public class ViewpointsSelectionWizardPage extends WizardPage { return extensions; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.WizardPage#isPageComplete() - */ @Override public boolean isPageComplete() { String errorMessage = null; @@ -191,18 +182,14 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /** * Return the list of selected viewpoints of this page. - * + * * @return the list of selected viewpoints */ public List<Viewpoint> getViewpoints() { return viewpoints; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { initializeDialogUnits(parent); @@ -258,10 +245,12 @@ public class ViewpointsSelectionWizardPage extends WizardPage { return Collections2.filter(registry.getViewpoints(), new Predicate<Viewpoint>() { + @Override public boolean apply(Viewpoint viewpoint) { for (final String ext : fileExtensions) { - if (new ViewpointQuery(viewpoint).handlesSemanticModelExtension(ext)) + if (new ViewpointQuery(viewpoint).handlesSemanticModelExtension(ext)) { return true; + } } return false; } @@ -271,7 +260,7 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /** * Create the table viewer. - * + * * @param parent * the parent composite. * @return the table viewer. @@ -297,6 +286,7 @@ public class ViewpointsSelectionWizardPage extends WizardPage { viewer.setLabelProvider(new ViewpointsTableLabelProvider()); viewer.addCheckStateListener(new ICheckStateListener() { + @Override public void checkStateChanged(final CheckStateChangedEvent event) { if (event.getChecked()) { viewpoints.add((Viewpoint) event.getElement()); @@ -309,6 +299,7 @@ public class ViewpointsSelectionWizardPage extends WizardPage { viewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { @@ -333,7 +324,7 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /*** * Set the browser input.A jface like browser viewer would have been better. - * + * * @param viewpoint * the viewpoint to document */ @@ -358,8 +349,9 @@ public class ViewpointsSelectionWizardPage extends WizardPage { private boolean containsHTMLDocumentation(Viewpoint viewpoint) { if (viewpoint != null) { final String doc = viewpoint.getEndUserDocumentation(); - if (!StringUtil.isEmpty(doc)) + if (!StringUtil.isEmpty(doc)) { return doc.startsWith("<html>"); //$NON-NLS-1$ + } } return false; } @@ -456,13 +448,14 @@ public class ViewpointsSelectionWizardPage extends WizardPage { content.append("<body>"); //$NON-NLS-1$ if (viewpoint == null) { - content.append("<br><br><center><b>Documentation</b></center>"); + content.append("<br><br><center><b>").append(Messages.ViewpointsSelectionWizardPage_documentation_title).append("</b></center>"); //$NON-NLS-1$ //$NON-NLS-2$ } else { final String endUserDocumentation = viewpoint.getEndUserDocumentation(); - if (!StringUtil.isEmpty(endUserDocumentation)) + if (!StringUtil.isEmpty(endUserDocumentation)) { content.append(viewpoint.getEndUserDocumentation()); - else - content.append("no documentation for this viewpoint"); + } else { + content.append(Messages.ViewpointsSelectionWizardPage_documentation_none); + } } content.append("</body>"); //$NON-NLS-1$ return this; @@ -487,26 +480,19 @@ public class ViewpointsSelectionWizardPage extends WizardPage { /** * return if the page is the current page. - * + * * @return if the page is the current page. */ public boolean isCurrentPageOnWizard() { return super.isCurrentPage(); } - /** - * - * @author mchauvin - */ private class ViewpointsTableLabelProvider extends AdapterFactoryLabelProvider implements ITableLabelProvider { public ViewpointsTableLabelProvider() { super(ViewHelper.INSTANCE.createAdapterFactory()); } - /** - * {@inheritDoc} - */ @Override public Image getColumnImage(Object element, int columnIndex) { Image image = null; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddModelDependencyAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddModelDependencyAction.java index ae82b24162..179197e21b 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddModelDependencyAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddModelDependencyAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -28,6 +28,7 @@ import org.eclipse.sirius.ui.tools.api.actions.analysis.IAddModelDependencyWizar import org.eclipse.sirius.ui.tools.internal.dialogs.SemanticResourceDialog; import org.eclipse.sirius.ui.tools.internal.operations.SemanticResourceAdditionOperation; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; @@ -52,17 +53,12 @@ public class AddModelDependencyAction extends Action { * the session for which we will add a model dependency */ public AddModelDependencyAction(Session session) { - super("Add Model"); + super(Messages.AddModelDependencyAction_title); final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/add.gif"); //$NON-NLS-1$ setImageDescriptor(descriptor); this.session = session; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ @Override public void run() { super.run(); @@ -82,7 +78,7 @@ public class AddModelDependencyAction extends Action { } private void createSemanticResourceDialog() { - final ResourceDialog resourceDialog = new SemanticResourceDialog(Display.getCurrent().getActiveShell(), "Select resources to add", SWT.OPEN | SWT.MULTI); + final ResourceDialog resourceDialog = new SemanticResourceDialog(Display.getCurrent().getActiveShell(), Messages.AddModelDependencyAction_resourceSelectionMessage, SWT.OPEN | SWT.MULTI); if (resourceDialog.open() == Window.OK) { List<URI> uris = resourceDialog.getURIs(); @@ -98,9 +94,9 @@ public class AddModelDependencyAction extends Action { } } } catch (InvocationTargetException e) { - SiriusPlugin.getDefault().error("Error adding model dependency", e); + SiriusPlugin.getDefault().error(Messages.AddModelDependencyAction_error, e); } catch (InterruptedException e) { - SiriusPlugin.getDefault().error("Error adding model dependency", e); + SiriusPlugin.getDefault().error(Messages.AddModelDependencyAction_error, e); } } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddSemanticResourceAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddSemanticResourceAction.java index bac758facc..4e5b6d4540 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddSemanticResourceAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/AddSemanticResourceAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -21,6 +21,7 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.ui.tools.api.actions.analysis.IAddModelDependencyWizard; import org.eclipse.sirius.ui.tools.internal.wizards.CreateOrAddResourceWizard; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -54,7 +55,7 @@ public class AddSemanticResourceAction extends Action { * the URI of each session on which to add a semantic resource */ public AddSemanticResourceAction(final Collection<URI> sessionsURIs) { - super("Add Model"); + super(Messages.AddSemanticResourceAction_title); final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/add.gif"); //$NON-NLS-1$ setImageDescriptor(descriptor); this.sessionsURI = sessionsURIs; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/IAddModelDependencyWizardDescriptor.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/IAddModelDependencyWizardDescriptor.java index cdd083dcde..b7dacd6d53 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/IAddModelDependencyWizardDescriptor.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/IAddModelDependencyWizardDescriptor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -19,16 +19,16 @@ import org.eclipse.sirius.ui.tools.api.actions.analysis.IAddModelDependencyWizar * Describes a extension as contributed to the * {@link IAddModelDependencyWizardRegistryListener#MODEL_DEPENDENCY_WIZARD_EXTENSION_POINT} * extension point. - * + * * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a> - * + * */ public class IAddModelDependencyWizardDescriptor { /** * Name of the attribute corresponding to the contributed class's path. */ - public static final String RESOURCE_WIZARD_EXTENSION_CONTRIBUTED_CLASS_NAME = "class"; + public static final String RESOURCE_WIZARD_EXTENSION_CONTRIBUTED_CLASS_NAME = "class"; //$NON-NLS-1$ /** * Configuration element of this descriptor . @@ -47,25 +47,25 @@ public class IAddModelDependencyWizardDescriptor { /** * Instantiates a descriptor with all information. - * + * * @param configuration * Configuration element from which to create this descriptor. */ public IAddModelDependencyWizardDescriptor(IConfigurationElement configuration) { element = configuration; - extensionClassName = configuration.getAttribute(RESOURCE_WIZARD_EXTENSION_CONTRIBUTED_CLASS_NAME); + extensionClassName = configuration.getAttribute(IAddModelDependencyWizardDescriptor.RESOURCE_WIZARD_EXTENSION_CONTRIBUTED_CLASS_NAME); } /** * Creates an instance of this descriptor's * {@link IAddModelDependencyWizard} . - * + * * @return A new instance of this descriptor's * {@link IAddModelDependencyWizard}. */ public IAddModelDependencyWizard getWizard() { try { - extension = (IAddModelDependencyWizard) element.createExecutableExtension(RESOURCE_WIZARD_EXTENSION_CONTRIBUTED_CLASS_NAME); + extension = (IAddModelDependencyWizard) element.createExecutableExtension(IAddModelDependencyWizardDescriptor.RESOURCE_WIZARD_EXTENSION_CONTRIBUTED_CLASS_NAME); } catch (CoreException e) { SiriusTransPlugin.INSTANCE.error(e.getMessage(), e); } @@ -74,7 +74,7 @@ public class IAddModelDependencyWizardDescriptor { /** * Returns the fully qualified name of the contributed class. - * + * * @return the fully qualified name of the contributed class */ public String getExtensionClassName() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveRepresentationResourceAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveRepresentationResourceAction.java index 64c9ad0da5..c30339ab32 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveRepresentationResourceAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveRepresentationResourceAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -27,6 +27,7 @@ import org.eclipse.sirius.ui.business.api.dialect.DialectEditor; import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.ISaveablePart2; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -34,11 +35,11 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import com.google.common.collect.Sets; /** - * + * * Action to remove a representation resource from a session. - * + * * @author cbrun - * + * */ public class RemoveRepresentationResourceAction extends Action { @@ -48,29 +49,26 @@ public class RemoveRepresentationResourceAction extends Action { /** * Create the action. - * + * * @param diagramResources * resource to remove. * @param session * current session. */ public RemoveRepresentationResourceAction(final Collection<Resource> diagramResources, final Session session) { - super("Remove from representations file", AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/remove.gif")); //$NON-NLS-2$ + super(Messages.RemoveRepresentationResourceAction_name, AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/remove.gif")); //$NON-NLS-1$ this.diagramResources = Sets.newHashSet(diagramResources); this.session = session; } - /** - * {@inheritDoc} - */ @Override public void run() { final IEditingSession ui = SessionUIManager.INSTANCE.getUISession(session); int choice = ISaveablePart2.YES; if (session.getStatus() == SessionStatus.DIRTY) { /* Show a dialog. */ - choice = SWTUtil.showSaveDialog(session, "Save representations file before removing the resource ?", true); + choice = SWTUtil.showSaveDialog(session, Messages.RemoveRepresentationResourceAction_saveDialogTitle, true); } if (ui != null) { if (choice != ISaveablePart2.CANCEL) { @@ -98,9 +96,6 @@ public class RemoveRepresentationResourceAction extends Action { } } - /** - * {@inheritDoc} - */ @Override public boolean isEnabled() { boolean mainResDeletion = diagramResources.contains(session.getSessionResource()); @@ -110,7 +105,7 @@ public class RemoveRepresentationResourceAction extends Action { /** * Command to remove an analysis from the session. - * + * * @author mporhel */ private class RemoveRepresentationResourcesCommand extends RecordingCommand { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java index d899913736..644337edfd 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/analysis/RemoveSemanticResourceAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -24,12 +24,13 @@ import org.eclipse.sirius.tools.api.command.semantic.RemoveSemanticResourceComma import org.eclipse.sirius.viewpoint.DAnalysisSessionEObject; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import com.google.common.collect.Iterables; /** * Action to remove semantic resources from a session. - * + * * @author ymortier */ public class RemoveSemanticResourceAction extends Action { @@ -42,23 +43,18 @@ public class RemoveSemanticResourceAction extends Action { /** * Creates a new {@link RemoveSemanticResourceAction}. - * + * * @param selection * the resources to remove. * @param session * the session to change. */ public RemoveSemanticResourceAction(final Collection<Resource> selection, final Session session) { - super("Remove Model"); + super(Messages.RemoveSemanticResourceAction_name); this.session = session; this.toRemove = new ArrayList<Resource>(selection); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#isEnabled() - */ @Override public boolean isEnabled() { boolean res = super.isEnabled(); @@ -68,11 +64,6 @@ public class RemoveSemanticResourceAction extends Action { return res; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ @Override public void run() { if (!isEnabled() || !checkResources()) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/ControlAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/ControlAction.java index 487c1eb6b9..7fa24f150f 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/ControlAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/ControlAction.java @@ -1,7 +1,7 @@ /** * <copyright> * - * Copyright (c) 2006-2007 IBM Corporation and others. + * Copyright (c) 2006, 2015 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 @@ -69,7 +69,7 @@ public class ControlAction extends CommandActionHandler { protected boolean canceled = false; public ControlAction(EditingDomain domain) { - super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Control_menu_item")); + super(domain, EMFEditUIPlugin.INSTANCE.getString("_UI_Control_menu_item")); //$NON-NLS-1$ } public ControlAction() { @@ -96,15 +96,15 @@ public class ControlAction extends CommandActionHandler { eObject = result ? (EObject) object : null; if (!AdapterFactoryEditingDomain.isControlled(object)) { - setText(EMFEditUIPlugin.INSTANCE.getString("_UI_Control_menu_item")); - setDescription("_UI_Control_menu_item_description"); + setText(EMFEditUIPlugin.INSTANCE.getString("_UI_Control_menu_item")); //$NON-NLS-1$ + setDescription(EMFEditUIPlugin.INSTANCE.getString("_UI_Control_menu_item_description")); //$NON-NLS-1$ command = null; } else { - setText(EMFEditUIPlugin.INSTANCE.getString("_UI_Uncontrol_menu_item")); - setDescription("_UI_Uncontrol_menu_item_description"); + setText(EMFEditUIPlugin.INSTANCE.getString("_UI_Uncontrol_menu_item")); //$NON-NLS-1$ + setDescription(EMFEditUIPlugin.INSTANCE.getString("_UI_Uncontrol_menu_item_description")); //$NON-NLS-1$ if (result) { command = new RemoveCommand(domain, eObject.eResource().getContents(), eObject); - command = new SelfAffectingCommand(EMFEditUIPlugin.INSTANCE.getString("_UI_UncontrolCommand_label"), command); + command = new SelfAffectingCommand(EMFEditUIPlugin.INSTANCE.getString("_UI_UncontrolCommand_label"), command); //$NON-NLS-1$ result = command.canExecute(); } } @@ -144,7 +144,7 @@ public class ControlAction extends CommandActionHandler { } command = new AddCommand(domain, resource.getContents(), eObject); - command = new SelfAffectingCommand(EMFEditUIPlugin.INSTANCE.getString("_UI_ControlCommand_label"), command); + command = new SelfAffectingCommand(EMFEditUIPlugin.INSTANCE.getString("_UI_ControlCommand_label"), command); //$NON-NLS-1$ } // Ensure that all proxies are resolved so that references into the @@ -181,7 +181,7 @@ public class ControlAction extends CommandActionHandler { protected EObject controledObject; public ControlResourceDialog(Shell parent, EditingDomain domain, Resource currentResource, final EObject controledObject) { - super(parent, EMFEditUIPlugin.INSTANCE.getString("_UI_ControlDialog_title"), SWT.SAVE); + super(parent, EMFEditUIPlugin.INSTANCE.getString("_UI_ControlDialog_title"), SWT.SAVE); //$NON-NLS-1$ this.domain = domain; this.currentResource = currentResource; this.controledObject = controledObject; @@ -221,11 +221,11 @@ public class ControlAction extends CommandActionHandler { boolean resourceInSet = resource != null; if (resource == currentResource) { - MessageDialog.openError(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_InvalidURI_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_AlreadyInResource")); + MessageDialog.openError(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_InvalidURI_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_AlreadyInResource")); //$NON-NLS-1$ //$NON-NLS-2$ return false; } if (domain.isReadOnly(resource)) { - MessageDialog.openError(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_InvalidURI_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_ReadOnlyResource")); + MessageDialog.openError(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_InvalidURI_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_ReadOnlyResource")); //$NON-NLS-1$ //$NON-NLS-2$ return false; } @@ -244,7 +244,7 @@ public class ControlAction extends CommandActionHandler { if (!resourceInSet) { resource = resourceSet.createResource(uri); if (resource == null) { - MessageDialog.openError(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_InvalidURI_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_CannotCreateResource")); + MessageDialog.openError(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_InvalidURI_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_CannotCreateResource")); //$NON-NLS-1$ //$NON-NLS-2$ return false; } @@ -260,9 +260,9 @@ public class ControlAction extends CommandActionHandler { boolean result = true; if (resourceBad) { - result = MessageDialog.openQuestion(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_ExistingResource_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_ReplaceResource")); + result = MessageDialog.openQuestion(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_ExistingResource_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_ReplaceResource")); //$NON-NLS-1$ //$NON-NLS-2$ } else if (resourceExists) { - result = MessageDialog.openQuestion(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_ExistingResource_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_AddToResource")); + result = MessageDialog.openQuestion(getShell(), EMFEditUIPlugin.INSTANCE.getString("_UI_ExistingResource_label"), EMFEditUIPlugin.INSTANCE.getString("_WARN_AddToResource")); //$NON-NLS-1$ //$NON-NLS-2$ } if (!result && !resourceInSet && resource != null) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/DesignerControlAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/DesignerControlAction.java index da857560b9..fc3a3794e1 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/DesignerControlAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/control/DesignerControlAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -28,6 +28,7 @@ import org.eclipse.sirius.business.api.session.SessionStatus; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; import org.eclipse.sirius.ui.tools.api.control.SiriusControlHandler; import org.eclipse.sirius.ui.tools.api.control.SiriusUncontrolHandler; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.ISaveablePart2; @@ -36,22 +37,19 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; /** * A specific control action handling representations. - * + * * @author cbrun */ public class DesignerControlAction extends ControlAction { /** * Create a new action to control the models. - * + * */ public DesignerControlAction() { super(); } - /** - * {@inheritDoc} - */ @Override public void run() { final boolean controlling = this.command == null; @@ -61,7 +59,7 @@ public class DesignerControlAction extends ControlAction { if (session != null) { if (session.getStatus() == SessionStatus.DIRTY) { /* Show a dialog. */ - choice = SWTUtil.showSaveDialog(session, "Representations file", true); + choice = SWTUtil.showSaveDialog(session, Messages.DesignerControlAction_saveDialogTitle, true); } if (choice == ISaveablePart2.YES) { @@ -71,10 +69,10 @@ public class DesignerControlAction extends ControlAction { @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { try { - monitor.beginTask((controlling ? "Control" : "Uncontrol") + " resources", 2); + monitor.beginTask(controlling ? Messages.DesignerControlAction_controlTask : Messages.DesignerControlAction_uncontrolTask, 2); if (session.isOpen()) { - monitor.subTask("Session saving"); + monitor.subTask(Messages.DesignerControlAction_savingTask); session.save(new SubProgressMonitor(monitor, 1)); } if (controlling) { @@ -98,9 +96,6 @@ public class DesignerControlAction extends ControlAction { updateSelection(getStructuredSelection()); } - /** - * {@inheritDoc} - */ @Override public boolean updateSelection(final IStructuredSelection selection) { // At each selection changed, we must reset the eObject to avoid a diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/copy/CopyRepresentationAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/copy/CopyRepresentationAction.java index 2e0eafe44b..98f15ede0f 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/copy/CopyRepresentationAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/copy/CopyRepresentationAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -25,6 +25,7 @@ import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuth import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationContainer; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.ISharedImages; import org.eclipse.ui.PlatformUI; @@ -34,7 +35,7 @@ import com.google.common.collect.Iterables; /** * An action to copy selected representations. - * + * * @author mchauvin */ public class CopyRepresentationAction extends Action { @@ -45,14 +46,14 @@ public class CopyRepresentationAction extends Action { /** * Construct a new instance. - * + * * @param session * the current session * @param selection * the selected representation to copy */ public CopyRepresentationAction(final Session session, final Collection<DRepresentation> selection) { - super("Copy"); + super(Messages.CopyRepresentationAction_name); this.session = session; this.representations = selection; @@ -74,14 +75,14 @@ public class CopyRepresentationAction extends Action { if (representations.size() == 1) { final String oldName = getOldName(); dialog = new RenameDialog(Display.getCurrent().getActiveShell(), oldName); - dialog.setTitle("Copy representation"); + dialog.setTitle(Messages.CopyRepresentationAction_copyRepresentationDialog_title); dialog.create(); } else { final String prefix = getPrefix(); dialog = new RenameDialog(Display.getCurrent().getActiveShell(), prefix); - dialog.setTitle("Copy representations"); - dialog.setMessage("Prefix for copied representations:"); - dialog.setDefaultNewName("Copy of"); + dialog.setTitle(Messages.CopyRepresentationAction_copyRepresentationsDialog_title); + dialog.setMessage(Messages.CopyRepresentationAction_copyRepresentationsDialog_message); + dialog.setDefaultNewName(Messages.CopyRepresentationAction_copyRepresentationsDialog_defaultNewName); dialog.create(); } @@ -105,7 +106,7 @@ public class CopyRepresentationAction extends Action { /** * Test if the selection is valid. - * + * * @return true if the selection is valid */ private boolean isValidSelection() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationAction.java index 2a266fc70b..57cf5a0ef2 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -144,7 +144,7 @@ public class CreateRepresentationAction extends Action { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { - monitor.beginTask("Representation creation", 5); + monitor.beginTask(org.eclipse.sirius.viewpoint.provider.Messages.CreateRepresentationAction_creationTask, 5); CreateRepresentationCommand createRepresentationCommand = new CreateRepresentationCommand(session, description, selection, representationName, new SubProgressMonitor(monitor, 4)); @@ -164,7 +164,7 @@ public class CreateRepresentationAction extends Action { @Override public void run(final IProgressMonitor monitor) { try { - monitor.beginTask("Representation opening", 1); + monitor.beginTask(org.eclipse.sirius.viewpoint.provider.Messages.CreateRepresentationAction_openingTask, 1); DialectUIManager.INSTANCE.openEditor(session, createdDRepresentation, new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationFromSessionAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationFromSessionAction.java index 2412b7be43..ffa8ad7bbd 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationFromSessionAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/creation/CreateRepresentationFromSessionAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -17,6 +17,7 @@ import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.ui.tools.internal.wizards.CreateRepresentationWizard; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.PlatformUI; /** @@ -49,15 +50,10 @@ public class CreateRepresentationFromSessionAction extends Action { * {@link ImageDescriptor} */ public CreateRepresentationFromSessionAction(final URI sessionURI, ImageDescriptor descriptor) { - super("Create Representation", descriptor); + super(Messages.CreateRepresentationFromSessionAction_name, descriptor); this.sessionURI = sessionURI; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ @Override public void run() { super.run(); @@ -67,9 +63,8 @@ public class CreateRepresentationFromSessionAction extends Action { wizard.init(); final WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), wizard); dialog.create(); - dialog.getShell().setText("Create Representation Wizard"); + dialog.getShell().setText(Messages.CreateRepresentationFromSessionAction_wizardTitle); dialog.open(); } } - } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/AbstractExportRepresentationsAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/AbstractExportRepresentationsAction.java index ff298093d4..cf75adbacd 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/AbstractExportRepresentationsAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/AbstractExportRepresentationsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES 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 @@ -35,6 +35,7 @@ import org.eclipse.sirius.ui.tools.api.dialogs.AbstractExportRepresentationsAsIm import org.eclipse.sirius.ui.tools.api.dialogs.ExportOneRepresentationAsImageDialog; import org.eclipse.sirius.ui.tools.api.dialogs.ExportSeveralRepresentationsAsImagesDialog; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; @@ -130,9 +131,9 @@ public abstract class AbstractExportRepresentationsAction extends Action { try { pmd.run(false, false, exportAction); } catch (final InvocationTargetException e) { - MessageDialog.openError(shell, "Error", e.getTargetException().getMessage()); + MessageDialog.openError(shell, Messages.AbstractExportRepresentationsAction_error, e.getTargetException().getMessage()); } catch (final InterruptedException e) { - MessageDialog.openInformation(shell, "Cancelled", e.getMessage()); + MessageDialog.openInformation(shell, Messages.AbstractExportRepresentationsAction_error, e.getMessage()); } finally { pmd.close(); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsAction.java index 0414450201..014b0faa7c 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -23,6 +23,7 @@ import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; import org.eclipse.sirius.ui.business.api.dialect.ExportFormat; import org.eclipse.sirius.ui.business.api.dialect.ExportFormat.ExportDocumentFormat; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -34,7 +35,7 @@ import com.google.common.collect.Sets; /** * Action to export representations as images. - * + * * @author cbrun */ public class ExportRepresentationsAction extends AbstractExportRepresentationsAction { @@ -54,7 +55,7 @@ public class ExportRepresentationsAction extends AbstractExportRepresentationsAc /** * Build the action. - * + * * @param session * the current {@link Session}. * @param selectedEObjects @@ -63,7 +64,7 @@ public class ExportRepresentationsAction extends AbstractExportRepresentationsAc * the selected {@link DRepresentation}. */ public ExportRepresentationsAction(Session session, Collection<EObject> selectedEObjects, Collection<DRepresentation> selectedRepresentations) { - super(SiriusEditPlugin.INSTANCE.getString("exportRepresentationsAsImagesActionLabel"), AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/image.gif")); + super(Messages.ExportRepresentationsAction_label, AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/image.gif")); //$NON-NLS-1$ this.session = session; this.selectedEObjects = selectedEObjects; this.selectedRepresentations = selectedRepresentations; @@ -74,7 +75,8 @@ public class ExportRepresentationsAction extends AbstractExportRepresentationsAc if (!getDRepresentationToExport().isEmpty()) { super.run(); } else { - MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Export representations", "The selected elements do not contain any representation to export."); + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.ExportRepresentationsAction_noRepresentationsDialog_title, + Messages.ExportRepresentationsAction_noRepresentationsDialog_message); } } @@ -84,7 +86,7 @@ public class ExportRepresentationsAction extends AbstractExportRepresentationsAc if (dRepresentationsToExport.isEmpty()) { dRepresentationsToExport.addAll(computeAllRepresentationsUnderSemantic()); } - return Lists.newArrayList(Iterables.filter(dRepresentationsToExport, exportableRepresentation)); + return Lists.newArrayList(Iterables.filter(dRepresentationsToExport, ExportRepresentationsAction.exportableRepresentation)); } @Override diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsFromFileAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsFromFileAction.java index c30418764d..1f5d9a4393 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsFromFileAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/export/ExportRepresentationsFromFileAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -37,6 +37,7 @@ import org.eclipse.sirius.common.tools.api.resource.ImageFileFormat; import org.eclipse.sirius.ui.tools.api.actions.export.ExportAction; import org.eclipse.sirius.ui.tools.api.dialogs.ExportSeveralRepresentationsAsImagesDialog; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; @@ -47,27 +48,18 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; /** * An eclipse action to export all representations of representations file to * images. - * + * * @author mchauvin */ public class ExportRepresentationsFromFileAction implements IObjectActionDelegate { private IFile sessionResourceFile; - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, - * org.eclipse.ui.IWorkbenchPart) - */ + @Override public void setActivePart(final IAction action, final IWorkbenchPart targetPart) { } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) - */ + @Override public void run(final IAction action) { final Shell shell = Display.getCurrent().getActiveShell(); @@ -94,7 +86,7 @@ public class ExportRepresentationsFromFileAction implements IObjectActionDelegat Session session = null; boolean isOpen = false; try { - monitor.beginTask("Export all representations to images", 10); + monitor.beginTask(Messages.ExportRepresentationsFromFileAction_exportTask, 10); session = SessionManager.INSTANCE.getSession(sessionResourceURI, new SubProgressMonitor(monitor, 1)); isOpen = session.isOpen(); if (!isOpen) { @@ -118,26 +110,22 @@ public class ExportRepresentationsFromFileAction implements IObjectActionDelegat pmd.run(false, false, exportAllRepresentationsRunnable); } catch (final InvocationTargetException e) { SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e)); - MessageDialog.openError(shell, "Error", e.getTargetException().getMessage()); + MessageDialog.openError(shell, Messages.ExportRepresentationsFromFileAction_errorDialog_title, e.getTargetException().getMessage()); } catch (final InterruptedException e) { SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, e.getLocalizedMessage(), e)); - MessageDialog.openInformation(shell, "Cancelled", e.getMessage()); + MessageDialog.openInformation(shell, Messages.ExportRepresentationsFromFileAction_interruptedDialog_title, e.getMessage()); } finally { pmd.close(); } } else { - MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Export representations", "The selected session do not contain any representation to export."); + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.ExportRepresentationsFromFileAction_noRepresentationsDialog_title, + Messages.ExportRepresentationsFromFileAction_noRepresentationsDialog_message); } } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, - * org.eclipse.jface.viewers.ISelection) - */ + @Override public void selectionChanged(final IAction action, final ISelection selection) { action.setEnabled(false); if (selection instanceof IStructuredSelection && !selection.isEmpty() && ((IStructuredSelection) selection).getFirstElement() instanceof IFile) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/nature/ModelingToggleNatureAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/nature/ModelingToggleNatureAction.java index 1e75644a12..9ed704d12d 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/nature/ModelingToggleNatureAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/nature/ModelingToggleNatureAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2013 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES 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 @@ -11,6 +11,7 @@ package org.eclipse.sirius.ui.tools.internal.actions.nature; import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; import java.util.Set; import org.eclipse.core.commands.AbstractHandler; @@ -27,6 +28,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.sirius.business.api.modelingproject.ModelingProject; import org.eclipse.sirius.tools.api.command.ui.UICallBack; import org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.handlers.HandlerUtil; @@ -35,18 +37,13 @@ import com.google.common.collect.Sets; /** * Enable toggle to modeling project. - * + * * @author <a href="mailto:julien.dupont@obeo.fr">Julien DUPONT</a> - * + * */ @SuppressWarnings("restriction") public class ModelingToggleNatureAction extends AbstractHandler { - - /** - * {@inheritDoc} - * - * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) - */ + @Override public Object execute(ExecutionEvent event) throws ExecutionException { Set<IProject> selectedProjects = getSelectedProjects(event); for (IProject project : selectedProjects) { @@ -75,7 +72,7 @@ public class ModelingToggleNatureAction extends AbstractHandler { /** * Toggles sample nature on a project. - * + * * @param project * to have sample nature added or removed */ @@ -83,6 +80,7 @@ public class ModelingToggleNatureAction extends AbstractHandler { try { PlatformUI.getWorkbench().getProgressService().run(true, false, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { if (ModelingProject.hasModelingProjectNature(project)) { @@ -93,7 +91,7 @@ public class ModelingToggleNatureAction extends AbstractHandler { } catch (CoreException e) { UICallBack uiCallback = SiriusEditPlugin.getPlugin().getUiCallback(); if (uiCallback != null) { - uiCallback.openError("Convert Project to Modeling project", "Impossible to convert the project: " + e.getMessage()); + uiCallback.openError(Messages.ModelingToggleNatureAction_errorDialogTitle, MessageFormat.format(Messages.ModelingToggleNatureAction_errorDialogMessage, e.getMessage())); } } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairAction.java index 52687071e2..710c89b741 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007-2009 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -23,22 +23,19 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.sirius.business.api.repair.SiriusRepairProcess; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionDelegate; /** * This action will be called when the user needs to repair a representations * file. - * + * * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> * @author mchauvin */ public class RepresentationFilesRepairAction extends ActionDelegate { - private static final String MSG_REPAIR_ERROR = "Repair error"; - - private static final String MSG_REPAIR_INTERRUPTED = "Repair interrupted"; - /** The file selected in the workspace. */ protected IFile file; @@ -49,11 +46,6 @@ public class RepresentationFilesRepairAction extends ActionDelegate { super(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction) - */ @Override public void run(final IAction action) { if (file != null) { @@ -62,6 +54,7 @@ public class RepresentationFilesRepairAction extends ActionDelegate { if (validationStatus.isOK()) { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SiriusRepairProcess process = new SiriusRepairProcess(file, true); process.run(monitor); @@ -71,36 +64,27 @@ public class RepresentationFilesRepairAction extends ActionDelegate { } } catch (final InvocationTargetException e) { dispose(); - final Status status = new Status(IStatus.ERROR, SiriusPlugin.ID, "Could not run repair process.", e.getCause()); - ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), MSG_REPAIR_ERROR, MSG_REPAIR_ERROR, status); + final Status status = new Status(IStatus.ERROR, SiriusPlugin.ID, Messages.RepresentationFilesRepairAction_repairFailed, e.getCause()); + ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.RepresentationFilesRepairAction_repairError, + Messages.RepresentationFilesRepairAction_repairError, status); SiriusPlugin.getDefault().getLog().log(status); } catch (final InterruptedException e) { dispose(); final Status status = new Status(IStatus.WARNING, SiriusPlugin.ID, e.getMessage(), e); - ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), MSG_REPAIR_INTERRUPTED, MSG_REPAIR_INTERRUPTED, status); + ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.RepresentationFilesRepairAction_repairInterrupted, + Messages.RepresentationFilesRepairAction_repairInterrupted, status); SiriusPlugin.getDefault().getLog().log(status); } } } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.actions.ActionDelegate#dispose() - */ @Override public void dispose() { super.dispose(); file = null; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, - * org.eclipse.jface.viewers.ISelection) - */ @Override public void selectionChanged(final IAction action, final ISelection selection) { if (selection instanceof IStructuredSelection) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairValidator.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairValidator.java index ebfba5c10f..ad995280eb 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairValidator.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/repair/RepresentationFilesRepairValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.actions.repair; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -26,6 +27,7 @@ import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.business.api.session.SessionStatus; import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; @@ -44,7 +46,7 @@ public class RepresentationFilesRepairValidator { /** * The name of the dialog which ask question. */ - public static final String MESSAGE_TITLE = "Repair confirmation"; + public static final String MESSAGE_TITLE = Messages.RepresentationFilesRepairValidator_confirmationDialogTitle; private static final int OPERATION_CANCELED = 0; @@ -108,38 +110,32 @@ public class RepresentationFilesRepairValidator { } boolean saveSessions = false; - String repairActionLabel = SiriusEditPlugin.getPlugin().getString("repairActionLabel"); - StringBuffer message = new StringBuffer("It's impossible to launch the \"" + repairActionLabel - + "\" action with opened representations file. So they will be closed before the repair process."); + String repairActionLabel = Messages.RepresentationFilesRepairValidator_repairActionLabel; + StringBuffer message = new StringBuffer(MessageFormat.format(Messages.RepresentationFilesRepairValidator_launchImpossibleRepresentationsOpened, repairActionLabel)); if (dirtySessionsName.size() > 0) { - message.append(" The following representations file"); if (dirtySessionsName.size() == 1) { - message.append(" has"); + message.append(" ").append(Messages.RepresentationFilesRepairValidator_representationFileModified); //$NON-NLS-1$ } else { - message.append("s have"); + message.append(" ").append(Messages.RepresentationFilesRepairValidator_representationFilesModified); //$NON-NLS-1$ } - message.append(" been modified : "); for (String dirtySessionName : dirtySessionsName) { - message.append("\n\t- '"); - message.append(dirtySessionName); - message.append("'"); - message.append(", "); + message.append(MessageFormat.format("\n\t- ''{0}'', ", dirtySessionName)); //$NON-NLS-1$ } message.delete(message.length() - 2, message.length() - 1); - message.append("\n\nSave changes?"); + message.append("\n\n").append(Messages.RepresentationFilesRepairValidator_askSave); //$NON-NLS-1$ String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; final MessageDialog dialog = new MessageDialog(shell, MESSAGE_TITLE, null, message.toString(), MessageDialog.QUESTION, buttons, 0); int result = dialog.open(); if (result == SWT.DEFAULT || buttons[result].equals(IDialogConstants.CANCEL_LABEL)) { - throw new CoreException(new Status(IStatus.CANCEL, SiriusEditPlugin.ID, RepresentationFilesRepairValidator.OPERATION_CANCELED, "Migration canceled by user.", null)); + throw new CoreException(new Status(IStatus.CANCEL, SiriusEditPlugin.ID, RepresentationFilesRepairValidator.OPERATION_CANCELED, Messages.RepresentationFilesRepairValidator_migrationCanceled, null)); } if (buttons[result].equals(IDialogConstants.YES_LABEL)) { saveSessions = true; } } else { - message.append("\nDo you want to continue?"); + message.append("\n").append(Messages.RepresentationFilesRepairValidator_askContinue); //$NON-NLS-1$ if (!MessageDialog.openConfirm(shell, MESSAGE_TITLE, message.toString())) { - throw new CoreException(new Status(IStatus.CANCEL, SiriusEditPlugin.ID, RepresentationFilesRepairValidator.OPERATION_CANCELED, "Migration canceled by user.", null)); + throw new CoreException(new Status(IStatus.CANCEL, SiriusEditPlugin.ID, RepresentationFilesRepairValidator.OPERATION_CANCELED, Messages.RepresentationFilesRepairValidator_migrationCanceled, null)); } } return saveSessions; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/CloseSessionsAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/CloseSessionsAction.java index e8af1009a0..60412d1913 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/CloseSessionsAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/CloseSessionsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -11,6 +11,7 @@ package org.eclipse.sirius.ui.tools.internal.actions.session; import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; import java.util.Collection; import org.eclipse.core.runtime.IStatus; @@ -23,6 +24,7 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.ui.tools.internal.commands.CloseUISessionCommand; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.SelectionListenerAction; @@ -73,9 +75,6 @@ public class CloseSessionsAction extends SelectionListenerAction { return !sessionsToCloseURI.isEmpty(); } - /** - * {@inheritDoc} - */ @Override public void run() { super.run(); @@ -94,9 +93,9 @@ public class CloseSessionsAction extends SelectionListenerAction { try { new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()).run(true, false, operation); } catch (InvocationTargetException e) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "An error occured : ", e)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format(Messages.CloseSessionsAction_error, e), e)); } catch (InterruptedException e) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "An error occured : ", e)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format(Messages.CloseSessionsAction_error, e), e)); } if (session.isOpen()) { session.close(new NullProgressMonitor()); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenCloseSessionActionProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenCloseSessionActionProvider.java index 52ee181f19..8d558b23c6 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenCloseSessionActionProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenCloseSessionActionProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -14,6 +14,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.IActionBars; import org.eclipse.ui.actions.OpenWithMenu; import org.eclipse.ui.navigator.CommonActionProvider; @@ -24,31 +25,19 @@ import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; /** * Provide the OpenCloseAnalysisAction on double click. - * + * * @author mporhel */ public class OpenCloseSessionActionProvider extends CommonActionProvider { private ICommonViewerWorkbenchSite viewSite; - /** - * - * {@inheritDoc} - * - * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) - */ @Override public void init(final ICommonActionExtensionSite aSite) { super.init(aSite); viewSite = (ICommonViewerWorkbenchSite) aSite.getViewSite(); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) - */ @Override public void fillActionBars(final IActionBars actionBars) { super.fillActionBars(actionBars); @@ -60,12 +49,6 @@ public class OpenCloseSessionActionProvider extends CommonActionProvider { } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) - */ @Override public void fillContextMenu(final IMenuManager menu) { super.fillContextMenu(menu); @@ -79,7 +62,7 @@ public class OpenCloseSessionActionProvider extends CommonActionProvider { } if (selection.getFirstElement() instanceof IFile) { final IFile file = (IFile) selection.getFirstElement(); - final IMenuManager submenu = new MenuManager("Open With", ICommonMenuConstants.GROUP_OPEN_WITH); + final IMenuManager submenu = new MenuManager(Messages.OpenCloseSessionActionProvider_openWithMenu, ICommonMenuConstants.GROUP_OPEN_WITH); submenu.add(new OpenWithMenu(viewSite.getPage(), file)); if (submenu.getItems().length > 0 && submenu.isEnabled()) { menu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu); @@ -88,7 +71,8 @@ public class OpenCloseSessionActionProvider extends CommonActionProvider { } private OpenCloseSessionAction createOpenCloseAnalysisAction(IStructuredSelection selection) { - OpenCloseSessionAction openCloseSessionAction = new OpenCloseSessionAction("Open", "Close"); + OpenCloseSessionAction openCloseSessionAction = new OpenCloseSessionAction(Messages.OpenCloseSessionActionProvider_openCloseAction_open, + Messages.OpenCloseSessionActionProvider_openCloseAction_close); openCloseSessionAction.selectionChanged(selection); return openCloseSessionAction; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenRepresentationsAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenRepresentationsAction.java index 78276975d9..e5dfe7c1aa 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenRepresentationsAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenRepresentationsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -28,6 +28,7 @@ import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.PlatformUI; @@ -39,7 +40,7 @@ import com.google.common.collect.Sets; /** * Action to open the given representations and init/update the corresponding ui * session(s). - * + * * @author mporhel */ public class OpenRepresentationsAction extends Action { @@ -48,12 +49,12 @@ public class OpenRepresentationsAction extends Action { /** * Constructor. - * + * * @param representations * representations to open. */ public OpenRepresentationsAction(Collection<DRepresentation> representations) { - super("Open"); + super(Messages.OpenRepresentationsAction_name); if (representations != null) { this.representationsToOpen = Sets.newLinkedHashSet(Iterables.filter(representations, Predicates.notNull())); @@ -62,7 +63,7 @@ public class OpenRepresentationsAction extends Action { /** * Constructor. - * + * * @param representation * representation to open. */ @@ -70,9 +71,6 @@ public class OpenRepresentationsAction extends Action { this(Collections.singletonList(representation)); } - /** - * {@inheritDoc} - */ @Override public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); @@ -80,6 +78,7 @@ public class OpenRepresentationsAction extends Action { try { IRunnableContext context = new ProgressMonitorDialog(shell); IRunnableWithProgress runnable = new IRunnableWithProgress() { + @Override public void run(final IProgressMonitor pm) { openRepresentations(representationsToOpen, pm); } @@ -95,13 +94,10 @@ public class OpenRepresentationsAction extends Action { } } - /** - * @param selection - */ private void openRepresentations(final Collection<DRepresentation> selection, final IProgressMonitor monitor) { - String taskName = "Open representation..."; + String taskName = Messages.OpenRepresentationsAction_openRepresentationsTask; if (selection.size() > 1) { - taskName = "Open representations..."; + taskName = Messages.OpenRepresentationsAction_openRepresentationsTask; } try { monitor.beginTask(taskName, 5 * selection.size()); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenViewpointSelectionAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenViewpointSelectionAction.java index 977ff37fd1..b6d6a21690 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenViewpointSelectionAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/actions/session/OpenViewpointSelectionAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES 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 @@ -16,24 +16,23 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; import org.eclipse.sirius.common.ui.tools.api.util.EclipseUIUtil; import org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelection; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; /** * An actions opening a dialog allowing to change the {@link ViewpointSelection} * . - * + * * @author alagarde - * + * */ public class OpenViewpointSelectionAction extends Action { - private static final String VIEWPOINTS_SELECTION_ACTION_TEXT = "Viewpoints Selection"; - private URI sessionURI; /** * Constructor. - * + * * @param session * the session on which viewpoints selection should be changed */ @@ -43,23 +42,21 @@ public class OpenViewpointSelectionAction extends Action { /** * Constructor. - * + * * @param sessionURI * the {@link URI} of session on which viewpoints selection * should be changed */ public OpenViewpointSelectionAction(URI sessionURI) { - super(VIEWPOINTS_SELECTION_ACTION_TEXT, SiriusEditPlugin.INSTANCE.getImageDescriptor("full/obj16/Viewpoint.gif")); //$NON-NLS-1$ + super(Messages.OpenViewpointSelectionAction_name, SiriusEditPlugin.INSTANCE.getImageDescriptor("full/obj16/Viewpoint.gif")); //$NON-NLS-1$ this.sessionURI = sessionURI; } - /** - * {@inheritDoc} - */ @Override public void run() { final Session session = SessionManager.INSTANCE.getExistingSession(sessionURI); EclipseUIUtil.displayAsyncExec(new Runnable() { + @Override public void run() { ViewpointSelection.openViewpointsSelectionDialog(session); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/commands/CloseUISessionCommand.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/commands/CloseUISessionCommand.java index 72c53b8125..a7b391b5eb 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/commands/CloseUISessionCommand.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/commands/CloseUISessionCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -23,15 +23,16 @@ import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.ISaveablePart2; import org.eclipse.ui.actions.WorkspaceModifyOperation; /** * Specific command to close the given session. - * + * * @author mporhel - * + * */ public class CloseUISessionCommand extends WorkspaceModifyOperation { @@ -39,24 +40,17 @@ public class CloseUISessionCommand extends WorkspaceModifyOperation { /** * * Specific command to close the given session. - * + * * @param session * the session to close. */ public CloseUISessionCommand(Session session) { - super(); this.session = session; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor) - */ @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { - monitor.beginTask("Close Representations file", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.CloseUISessionCommand_closeRepresentationFileTask, IProgressMonitor.UNKNOWN); if (session == null) { return; } @@ -69,7 +63,7 @@ public class CloseUISessionCommand extends WorkspaceModifyOperation { int choice = ISaveablePart2.YES; if (session.getStatus() == SessionStatus.DIRTY) { /* Show a dialog. */ - choice = SWTUtil.showSaveDialog(session, "Representations file", false); + choice = SWTUtil.showSaveDialog(session, Messages.CloseUISessionCommand_saveDialogTitle, false); saveSession = choice == ISaveablePart2.YES; } if (choice == ISaveablePart2.CANCEL) { @@ -80,7 +74,7 @@ public class CloseUISessionCommand extends WorkspaceModifyOperation { // example) // We may encounter an issue to connect to remote CDO server // during close process - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, "Error while closing the session", e)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, Messages.CloseUISessionCommand_closingError, e)); } final IEditingSession ui = SessionUIManager.INSTANCE.getUISession(session); @@ -99,7 +93,7 @@ public class CloseUISessionCommand extends WorkspaceModifyOperation { try { ui.close(saveSession); } catch (IllegalStateException e) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, "Error while closing the session", e)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, Messages.CloseUISessionCommand_closingError, e)); } monitor.worked(1); ui.close(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/RepresentationsSelectionDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/RepresentationsSelectionDialog.java index e4a4a7d4db..66dcc77b44 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/RepresentationsSelectionDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/RepresentationsSelectionDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -25,6 +25,7 @@ import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.Viewer; import org.eclipse.sirius.ui.tools.api.views.ViewHelper; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; @@ -38,7 +39,7 @@ import com.google.common.collect.Lists; * <p> * Use {@link #setTitle(String)} and {@link #setMessage(String)} to customize * the dialog to your use case. - * + * * @author pcdavid */ // TODO Could this be replaced by ListSelectionDialog or made more generic? @@ -63,7 +64,7 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I /** * Creates a new dialog to let the user choose a subset of existing * representations from a collection of candidates. - * + * * @param parentShell * the dialog's shell. * @param candidates @@ -73,6 +74,7 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I super(parentShell); this.candidateRepresentations = new ArrayList<DRepresentation>(candidates); Collections.sort(candidateRepresentations, new Comparator<DRepresentation>() { + @Override public int compare(final DRepresentation r1, final DRepresentation r2) { return r1.getName().compareTo(r2.getName()); } @@ -83,7 +85,7 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I /** * Returns the list of representations the user selected among the * candidates presented. - * + * * @return the list of representations selected by the candidate. May be * empty, but not <code>null</code>. */ @@ -93,7 +95,7 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I /** * Create the selection list. - * + * * @param parent * the parent control * @return the dialog area's content @@ -110,14 +112,17 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I checkList.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); checkList.setContentProvider(new IStructuredContentProvider() { + @Override public Object[] getElements(final Object inputElement) { return candidateRepresentations.toArray(); } + @Override public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { // Ignore. } + @Override public void dispose() { // Ignore. } @@ -131,10 +136,11 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I /** * Update {@link #selectedRepresentations} according to the event. - * + * * @param event * an event indicate a state change in a check-box. */ + @Override public void checkStateChanged(final CheckStateChangedEvent event) { if (event.getChecked()) { selectedRepresentations.add((DRepresentation) event.getElement()); @@ -143,13 +149,9 @@ public class RepresentationsSelectionDialog extends TitleAreaDialog implements I } } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ + @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); - newShell.setText("Startup representations"); + newShell.setText(Messages.RepresentationsSelectionDialog_shellTitle); }; } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/SemanticResourceDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/SemanticResourceDialog.java index d4025af172..8bbc1d7c69 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/SemanticResourceDialog.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/dialogs/SemanticResourceDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013 THALES GLOBAL SERVICES. + * Copyright (c) 2013, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.dialogs; +import java.text.MessageFormat; import java.util.Collections; import java.util.List; @@ -23,6 +24,7 @@ import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.sirius.business.api.query.FileQuery; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -35,13 +37,13 @@ import com.google.common.collect.Lists; /** * Specific resource dialog to avoid representation file selection. The browse * workspace dialog will not display those representation files. - * + * * The processResource method will check the selected value and open an error * dialog if representation files are detected. They will be removed from * selection. - * + * * @author mporhel - * + * */ public class SemanticResourceDialog extends ResourceDialog { @@ -49,16 +51,14 @@ public class SemanticResourceDialog extends ResourceDialog { /** * Default constructor. - * + * * @param parent * the parent shell * @param title * the dialog title * @param style * the dialog style - * - * /** Default constructor. - * + * * @see ResourceDialog */ public SemanticResourceDialog(Shell parent, String title, int style) { @@ -76,16 +76,16 @@ public class SemanticResourceDialog extends ResourceDialog { } if (!representationFiles.isEmpty()) { - String message = "Representation files can not be added as semantic resources"; - Status status = new Status(IStatus.WARNING, SiriusEditPlugin.ID, message + ": " + representationFiles); - ErrorDialog.openError(getParentShell(), "Incorrect selection", message + ", they will be removed from the selection.", status); + Status status = new Status(IStatus.WARNING, SiriusEditPlugin.ID, MessageFormat.format(Messages.SemanticResourceDialog_representationFilesCantBeAdded_status, representationFiles)); + ErrorDialog.openError(getParentShell(), Messages.SemanticResourceDialog_representationFilesCantBeAdded_title, Messages.SemanticResourceDialog_representationFilesCantBeAdded_message, + status); Iterables.removeAll(urIs, representationFiles); if (uriField != null && !uriField.isDisposed() && !urIs.isEmpty()) { StringBuilder sb = new StringBuilder(); for (URI uri : urIs) { sb.append(uri); - sb.append(SEPARATOR); + sb.append(SemanticResourceDialog.SEPARATOR); } uriField.setText(sb.toString().trim()); } @@ -108,11 +108,11 @@ public class SemanticResourceDialog extends ResourceDialog { StringBuffer uris = new StringBuffer(); IFile[] files = WorkspaceResourceDialog.openFileSelection(getShell(), null, null, true, null, filters); - for (int i = 0, len = files.length; i < len; i++) { - uris.append(URI.createPlatformResourceURI(files[i].getFullPath().toString(), true)); - uris.append(SEPARATOR); + for (IFile file : files) { + uris.append(URI.createPlatformResourceURI(file.getFullPath().toString(), true)); + uris.append(SemanticResourceDialog.SEPARATOR); } - uriField.setText((uriField.getText() + SEPARATOR + uris.toString()).trim()); + uriField.setText((uriField.getText() + SemanticResourceDialog.SEPARATOR + uris.toString()).trim()); } else { IFile file = null; @@ -135,16 +135,12 @@ public class SemanticResourceDialog extends ResourceDialog { /** * Exclude representation files. - * + * * @see {@link FileQuery#isSessionResourceFile()} * @author mporhel - * + * */ private static class PotentialSemanticResourceFilter extends ViewerFilter { - - /** - * {@inheritDoc} - */ @Override public boolean select(Viewer viewer, Object parentElement, Object element) { boolean isValid = true; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java index 473ac1ea61..045b4dd710 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/AbstractDTreeEditor.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.editor; +import java.text.MessageFormat; import java.util.Collection; import java.util.Collections; @@ -59,6 +60,7 @@ import org.eclipse.sirius.ui.tools.api.properties.DTablePropertySheetpage; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -143,11 +145,6 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE * SessionManagerListener. */ protected final SessionManagerListener sessionManagerListener = new SessionManagerListener.Stub() { - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.api.session.SessionManagerListener.Stub#notifyAddSession(org.eclipse.sirius.business.api.session.Session) - */ @Override public void notifyAddSession(final Session newSession) { @@ -394,7 +391,7 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE protected void getSession(final DSemanticDecorator rootElement) { session = SessionManager.INSTANCE.getSession(rootElement.getTarget()); if (session == null) { - SiriusTransPlugin.getPlugin().error("a DSemanticDecorator must be owned by a Session" + rootElement, null); + SiriusTransPlugin.getPlugin().error(MessageFormat.format(Messages.AbstractDTreeEditor_noSessionError, rootElement), null); } } @@ -495,7 +492,7 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE String title = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText(); final int end = title.lastIndexOf(".aird#"); //$NON-NLS-1$ if (end > -1) { - title = title.substring(0, end + 6) + this.getPartName() + " - Eclipse Platform"; + title = MessageFormat.format(Messages.AbstractDTreeEditor_eclipseWindowTitle, title.substring(0, end + 6) + this.getPartName()); PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(title); } } @@ -841,14 +838,12 @@ public abstract class AbstractDTreeEditor extends EditorPart implements DialectE */ protected void modelerDescriptionFilesLoaded() { if (isAutoRefresh()) { - Job refreshJob = new Job("Refresh ") { - + Job refreshJob = new Job(Messages.AbstractDTreeEditor_modelerDescriptionFilesLoadedJob) { @Override protected IStatus run(IProgressMonitor monitor) { getEditingDomain().getCommandStack().execute(new RefreshRepresentationsCommand(getEditingDomain(), monitor, getRepresentation())); return Status.OK_STATUS; } - }; refreshJob.schedule(); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/MenuHelper.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/MenuHelper.java index c1efeb6290..49a4e19f15 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/MenuHelper.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/MenuHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014 Obeo. + * Copyright (c) 2014, 2015 Obeo. * 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 @@ -38,12 +38,13 @@ import org.eclipse.sirius.viewpoint.SiriusPlugin; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.tool.RepresentationNavigationDescription; import org.eclipse.sirius.viewpoint.description.tool.ToolPackage; +import org.eclipse.sirius.viewpoint.provider.Messages; import com.google.common.collect.Lists; /** * Menus/actions common to all Sirius dialect editors. - * + * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ public final class MenuHelper { @@ -62,7 +63,7 @@ public final class MenuHelper { /** * Build the menus and corresponding actions for this <code>element</code> * and this navigation description <code>navDesc</code>. - * + * * @param openMenu * The menu manager in which to add the actions * @param interpreter @@ -80,7 +81,7 @@ public final class MenuHelper { public static boolean buildOpenRepresentationActions(final IMenuManager openMenu, final IInterpreter interpreter, final RepresentationNavigationDescription navDesc, final DRepresentationElement element, final Session session, final AdapterFactory adapterFactory) { boolean atLeastOneRepresentationActionsWasCreated = false; - Collection<EObject> candidates = findCandidates(element, navDesc, interpreter); + Collection<EObject> candidates = MenuHelper.findCandidates(element, navDesc, interpreter); for (EObject candidate : candidates) { Collection<DRepresentation> representations = DialectManager.INSTANCE.getRepresentations(candidate, session); for (DRepresentation representation : representations) { @@ -94,7 +95,7 @@ public final class MenuHelper { RuntimeLoggerManager.INSTANCE.error(navDesc, ToolPackage.eINSTANCE.getRepresentationNavigationDescription_NavigationNameExpression(), e); } } - openMenu.appendToGroup(OPEN_REPRESENTATION_GROUP_SEPARATOR, buildOpenRepresentationAction(session, representation, label, adapterFactory)); + openMenu.appendToGroup(MenuHelper.OPEN_REPRESENTATION_GROUP_SEPARATOR, MenuHelper.buildOpenRepresentationAction(session, representation, label, adapterFactory)); atLeastOneRepresentationActionsWasCreated = true; } } @@ -105,7 +106,7 @@ public final class MenuHelper { /** * Computes all the candidates for navigation from a starting element using * the specified navigation description. - * + * * @param element * the starting point. * @param navDesc @@ -131,7 +132,7 @@ public final class MenuHelper { /** * Build an action to open this <code>representation</code>. - * + * * @param session * The current session. * @param representation @@ -143,13 +144,13 @@ public final class MenuHelper { public static IAction buildOpenRepresentationAction(final Session session, final DRepresentation representation, final AdapterFactory adapterFactory) { String representationName = representation.getName(); if (StringUtil.isEmpty(representationName)) { - representationName = "(unnamed)"; + representationName = Messages.MenuHelper_anonymousRepresentation; RepresentationDescription representationDescription = DialectManager.INSTANCE.getDescription(representation); if (representationDescription != null) { representationName += " " + new IdentifiedElementQuery(representationDescription).getLabel(); //$NON-NLS-1$ } } - return buildOpenRepresentationAction(session, representation, representationName, adapterFactory); + return MenuHelper.buildOpenRepresentationAction(session, representation, representationName, adapterFactory); } private static IAction buildOpenRepresentationAction(final Session session, final DRepresentation representation, final String label, final AdapterFactory adapterFactory) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/NavigateToCommand.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/NavigateToCommand.java index 8fb968c4a8..a440aaab04 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/NavigateToCommand.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/editor/NavigateToCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES 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 @@ -18,11 +18,12 @@ import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.IEditorPart; /** * Specific command to navigate to another representation. - * + * * @author mporhel */ public class NavigateToCommand extends RecordingCommand { @@ -33,21 +34,18 @@ public class NavigateToCommand extends RecordingCommand { /** * Constructor. - * + * * @param session * the current session. * @param representation * the source representation. */ public NavigateToCommand(Session session, DRepresentation representation) { - super(session.getTransactionalEditingDomain(), "Navigate to another representation"); + super(session.getTransactionalEditingDomain(), Messages.NavigateToCommand_name); this.session = session; this.representation = representation; } - /** - * {@inheritDoc} - */ @Override protected void doExecute() { if (session == null || representation == null) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/operations/SemanticResourceAdditionOperation.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/operations/SemanticResourceAdditionOperation.java index 056c32b77f..7a218b40a2 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/operations/SemanticResourceAdditionOperation.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/operations/SemanticResourceAdditionOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -21,12 +21,13 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.tools.api.command.semantic.AddSemanticResourceCommand; +import org.eclipse.sirius.viewpoint.provider.Messages; import com.google.common.collect.Sets; /** * Operation to add a semantic resource to a session. - * + * * @author mchauvin */ public class SemanticResourceAdditionOperation implements IRunnableWithProgress { @@ -39,7 +40,7 @@ public class SemanticResourceAdditionOperation implements IRunnableWithProgress /** * Creates a new instance. - * + * * @param sessions * the sessions * @param uris @@ -50,12 +51,10 @@ public class SemanticResourceAdditionOperation implements IRunnableWithProgress this.uris = uris; } - /** - * {@inheritDoc} - */ + @Override public void run(IProgressMonitor monitor) throws java.lang.reflect.InvocationTargetException, InterruptedException { try { - monitor.beginTask("Semantic resource addition", uris.size() * sessions.size()); + monitor.beginTask(Messages.SemanticResourceAdditionOperation_semanticResourceAdditionTask, uris.size() * sessions.size()); results = Sets.newLinkedHashSet(); for (Session session : sessions) { TransactionalEditingDomain transDomain = session.getTransactionalEditingDomain(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/preference/SiriusPreferencePage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/preference/SiriusPreferencePage.java index 22e23c8398..102ca38e73 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/preference/SiriusPreferencePage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/preference/SiriusPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -17,6 +17,7 @@ import org.eclipse.sirius.business.api.preferences.SiriusPreferencesKeys; import org.eclipse.sirius.common.tools.api.constant.CommonPreferencesConstants; import org.eclipse.sirius.common.ui.SiriusTransPlugin; import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; @@ -28,7 +29,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; /** * Page for viewpoint preferences. - * + * * @author ymortier */ public class SiriusPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { @@ -36,7 +37,7 @@ public class SiriusPreferencePage extends FieldEditorPreferencePage implements I /** * Label of the check box emptyAirdFragmentOnControl. */ - public static final String EMPTY_AIRD_ON_CONTROL_CHECKBOX_LABEL = "Always create an aird fragment on control"; + public static final String EMPTY_AIRD_ON_CONTROL_CHECKBOX_LABEL = Messages.SiriusPreferencePage_emptyAirdOnControl; private BooleanFieldEditor refreshOnRepresentationOpening; @@ -54,11 +55,6 @@ public class SiriusPreferencePage extends FieldEditorPreferencePage implements I private IntegerFieldEditor groupSize; - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() - */ @Override protected void createFieldEditors() { setPreferenceStore(SiriusEditPlugin.getPlugin().getPreferenceStore()); @@ -77,53 +73,55 @@ public class SiriusPreferencePage extends FieldEditorPreferencePage implements I } private void addFilesFields(Composite parent) { - Composite fileComposite = createGroup(parent, "Files"); + Composite fileComposite = createGroup(parent, Messages.SiriusPreferencePage_filesGroup); - emptyAirdFragmentOnControl = new BooleanFieldEditorWithHelp(SiriusPreferencesKeys.PREF_EMPTY_AIRD_FRAGMENT_ON_CONTROL.name(), EMPTY_AIRD_ON_CONTROL_CHECKBOX_LABEL, - "Allow the creation of an empty aird fragment if there is no selected representation", new Composite(fileComposite, SWT.NONE)); + emptyAirdFragmentOnControl = new BooleanFieldEditorWithHelp(SiriusPreferencesKeys.PREF_EMPTY_AIRD_FRAGMENT_ON_CONTROL.name(), SiriusPreferencePage.EMPTY_AIRD_ON_CONTROL_CHECKBOX_LABEL, + Messages.SiriusPreferencePage_emptyAirdOnControl_help, new Composite(fileComposite, SWT.NONE)); addField(emptyAirdFragmentOnControl); - defensiveFileEdit = new BooleanFieldEditor(CommonPreferencesConstants.PREF_DEFENSIVE_EDIT_VALIDATION, "Validate file edits on command application.", new Composite(fileComposite, SWT.NONE)); + defensiveFileEdit = new BooleanFieldEditor(CommonPreferencesConstants.PREF_DEFENSIVE_EDIT_VALIDATION, Messages.SiriusPreferencePage_defensiveEditValidation, new Composite(fileComposite, + SWT.NONE)); addField(defensiveFileEdit); } private void addRefreshFields(Composite parent) { - Composite refreshComposite = createGroup(parent, "Refresh"); + Composite refreshComposite = createGroup(parent, Messages.SiriusPreferencePage_refreshGroup); - refreshOnRepresentationOpening = new BooleanFieldEditor(SiriusUIPreferencesKeys.PREF_REFRESH_ON_REPRESENTATION_OPENING.name(), "Do refresh on representation opening", new Composite( - refreshComposite, SWT.NONE)); + refreshOnRepresentationOpening = new BooleanFieldEditor(SiriusUIPreferencesKeys.PREF_REFRESH_ON_REPRESENTATION_OPENING.name(), Messages.SiriusPreferencePage_refreshOnRepresentationOpening, + new Composite(refreshComposite, SWT.NONE)); addField(refreshOnRepresentationOpening); - autoRefresh = new BooleanFieldEditor(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), "Automatic Refresh", new Composite(refreshComposite, SWT.NONE)); + autoRefresh = new BooleanFieldEditor(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), Messages.SiriusPreferencePage_autoRefresh, new Composite(refreshComposite, SWT.NONE)); addField(autoRefresh); } private void addProfilingField(Composite parent) { - Composite profilerComposite = createGroup(parent, "Profiler"); + Composite profilerComposite = createGroup(parent, Messages.SiriusPreferencePage_profilerGroup); - traceMode = new BooleanFieldEditorWithHelp(CommonPreferencesConstants.PREF_TRACE_ON, "Profiling", "Open the profiler view: Sirius Profiler > Time Profiler View.", new Composite( + traceMode = new BooleanFieldEditorWithHelp(CommonPreferencesConstants.PREF_TRACE_ON, Messages.SiriusPreferencePage_profiling, Messages.SiriusPreferencePage_profiling_help, new Composite( profilerComposite, SWT.NONE)); addField(traceMode); } private void addGroupTreeItemsField(Composite parent) { - Composite groupComposite = createGroup(parent, "Group tree items"); + Composite groupComposite = createGroup(parent, Messages.SiriusPreferencePage_groupingGroup); - groupEnable = new BooleanFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_ENABLE, "Enable", - "This feature handles a new intermediary tree level if the children size is above the threshold.", new Composite(groupComposite, SWT.NONE)); + groupEnable = new BooleanFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_ENABLE, Messages.SiriusPreferencePage_enableGrouping, Messages.SiriusPreferencePage_enableGrouping_help, + new Composite(groupComposite, SWT.NONE)); Composite groupTriggerComposite = new Composite(groupComposite, SWT.NONE); groupTriggerComposite.setLayout(new GridLayout(3, false)); groupTriggerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - groupTrigger = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_TRIGGER, "Threshold", - "The threshold needs to be higher or equal to the group size (otherwise Threshold = Group size).", groupTriggerComposite); + groupTrigger = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_TRIGGER, Messages.SiriusPreferencePage_groupingTheshold, + Messages.SiriusPreferencePage_groupingTheshold_help, groupTriggerComposite); groupTrigger.setValidRange(0, Integer.MAX_VALUE); Composite groupSizeComposite = new Composite(groupComposite, SWT.NONE); groupSizeComposite.setLayout(new GridLayout(3, false)); groupSizeComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - groupSize = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_SIZE, "Group size", "Group size needs to be higher than zero.", groupSizeComposite); + groupSize = new IntegerFieldEditorWithHelp(CommonPreferencesConstants.PREF_GROUP_SIZE, Messages.SiriusPreferencePage_groupingGroupSize, Messages.SiriusPreferencePage_groupingGroupSize_help, + groupSizeComposite); groupSize.setValidRange(0, Integer.MAX_VALUE); addField(groupEnable); addField(groupTrigger); @@ -143,17 +141,10 @@ public class SiriusPreferencePage extends FieldEditorPreferencePage implements I return group; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ + @Override public void init(final IWorkbench workbench) { } - /** - * {@inheritDoc} - */ @Override protected void initialize() { super.initialize(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/properties/SiriusCellEditorProviderCollector.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/properties/SiriusCellEditorProviderCollector.java index 9febb8e305..51cb34fe18 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/properties/SiriusCellEditorProviderCollector.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/properties/SiriusCellEditorProviderCollector.java @@ -18,6 +18,7 @@ import java.util.Set; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; @@ -25,11 +26,12 @@ import org.eclipse.sirius.common.tools.api.util.EclipseUtil; import org.eclipse.sirius.ext.emf.ui.ICellEditorProvider; import org.eclipse.sirius.ext.emf.ui.properties.CellEditorProviderCollector; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * This collector lookups within the * {@link SiriusCellEditorProviderCollector#EXTENSION_POINT_ID}. - * + * * @author Florian Barbin */ public final class SiriusCellEditorProviderCollector implements CellEditorProviderCollector { @@ -56,14 +58,14 @@ public final class SiriusCellEditorProviderCollector implements CellEditorProvid * Provides the unique instance of this class. To be lazy, the * SiriusCellEditorProviderExtensionPoint is instantiate the first time we * ask the instance. - * + * * @return the SiriusCellEditorProviderExtensionPoint */ public static SiriusCellEditorProviderCollector getInstance() { - if (instance == null) { - instance = new SiriusCellEditorProviderCollector(); + if (SiriusCellEditorProviderCollector.instance == null) { + SiriusCellEditorProviderCollector.instance = new SiriusCellEditorProviderCollector(); } - return instance; + return SiriusCellEditorProviderCollector.instance; } /** @@ -71,7 +73,7 @@ public final class SiriusCellEditorProviderCollector implements CellEditorProvid */ private void loadCache() { cache = new HashSet<ICellEditorProvider>(); - IConfigurationElement[] config = EclipseUtil.getConfigurationElementsFor(EXTENSION_POINT_ID); + IConfigurationElement[] config = EclipseUtil.getConfigurationElementsFor(SiriusCellEditorProviderCollector.EXTENSION_POINT_ID); for (IConfigurationElement configurationElement : config) { try { Object contribution = configurationElement.createExecutableExtension("class"); //$NON-NLS-1$ @@ -79,7 +81,7 @@ public final class SiriusCellEditorProviderCollector implements CellEditorProvid cache.add((ICellEditorProvider) contribution); } } catch (CoreException e) { - SiriusPlugin.getDefault().getLog().log(new Status(Status.WARNING, SiriusPlugin.ID, "Cannot instantiate the Cell Editor Provider contributions", e)); + SiriusPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, Messages.SiriusCellEditorProviderCollector_contributionInstantiationError, e)); } } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/ContextMenuFiller.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/ContextMenuFiller.java index 366985c092..f44b388f92 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/ContextMenuFiller.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/ContextMenuFiller.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -81,6 +81,7 @@ import org.eclipse.sirius.viewpoint.DAnalysis; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.ISaveablesSource; import org.eclipse.ui.IWorkbenchCommandConstants; @@ -102,8 +103,6 @@ import com.google.common.collect.Sets; */ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { - private static final String NEW_REPRESENTATION_MENU = "New Representation"; - private static final String NEW_REPRESENTATION_MENU_ID = "menu.viewpoint.new.representation"; //$NON-NLS-1$ private static final String SESSION_MANAGEMENT_SEPARATOR = "group.viewpoint.session"; //$NON-NLS-1$ @@ -230,7 +229,7 @@ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { } - addActionToMenu(menu, SEMANTIC_MANAGEMENT_SEPARATOR, new Action("Show in hierarchy") { + addActionToMenu(menu, SEMANTIC_MANAGEMENT_SEPARATOR, new Action(Messages.ContextMenuFiller_showInHierarchy) { @Override public void run() { modelViewer.setSelection(newSelection, true); @@ -348,7 +347,7 @@ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { /* New representations menu */ final Collection<RepresentationDescription> descriptions = DialectManager.INSTANCE.getAvailableRepresentationDescriptions(session.getSelectedViewpoints(false), firstSelected); if (descriptions.size() > 0) { - final MenuManager addNewRepresentation = new MenuManager(NEW_REPRESENTATION_MENU, NEW_REPRESENTATION_MENU_ID); + final MenuManager addNewRepresentation = new MenuManager(Messages.ContextMenuFiller_newRepresentation, NEW_REPRESENTATION_MENU_ID); for (final RepresentationDescription representationDescription : descriptions) { if (DialectManager.INSTANCE.canCreate(firstSelected, representationDescription)) { addNewRepresentation.add(buildCreateRepresentationAction(firstSelected, representationDescription, session)); @@ -479,7 +478,7 @@ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { * @param targetResources */ private void computeMoveMenu(IMenuManager menu, final Session session, final Collection<DRepresentation> movableRepresentations, final Collection<Resource> targetResources) { - final MenuManager moveMenu = new MenuManager("Move", "1"); + final MenuManager moveMenu = new MenuManager(Messages.ContextMenuFiller_move, "1"); //$NON-NLS-1$ for (final Resource target : targetResources) { if (!target.getContents().isEmpty() && target.getContents().get(0) instanceof DAnalysis) { moveMenu.add(buildMoveRepresentationsActions(session, movableRepresentations, (DAnalysis) target.getContents().get(0))); @@ -567,7 +566,7 @@ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { private Action buildCloseSessionAction(final List<Session> selection) { final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/close.gif"); //$NON-NLS-1$ - CloseSessionsAction closeSessionsAction = new CloseSessionsAction("Close"); + CloseSessionsAction closeSessionsAction = new CloseSessionsAction(Messages.ContextMenuFiller_closeSession); closeSessionsAction.setImageDescriptor(descriptor); closeSessionsAction.selectionChanged(new StructuredSelection(selection)); return closeSessionsAction; @@ -575,7 +574,7 @@ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { private Action buildSaveSessionAction(final List<Session> selection) { final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/save.gif"); //$NON-NLS-1$ - return new Action("Save", descriptor) { + return new Action(Messages.ContextMenuFiller_saveSession, descriptor) { @Override public void run() { super.run(); @@ -593,7 +592,7 @@ public class ContextMenuFiller implements IMenuListener, IMenuListener2 { try { saveable.doSave(monitor); } catch (CoreException e) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Error at session saving", e)); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, Messages.ContextMenuFiller_saveSessionError, e)); } } } else { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/SessionLabelProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/SessionLabelProvider.java index 325fce4282..b90059a62d 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/SessionLabelProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/SessionLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2009, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common; +import java.text.MessageFormat; + import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.notify.AdapterFactory; @@ -22,6 +24,7 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.sirius.common.ui.tools.api.view.common.item.ItemDecorator; import org.eclipse.sirius.ui.tools.api.views.common.item.ItemWrapper; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.PlatformUI; @@ -30,14 +33,14 @@ import com.google.common.collect.Iterables; /** * Label provider used for the session . - * + * * @author cedric - * + * */ public class SessionLabelProvider extends AdapterFactoryLabelProvider { /** * Create a new session label provider. - * + * * @param adapterFactory * the adapter factory to delegate to. */ @@ -45,9 +48,6 @@ public class SessionLabelProvider extends AdapterFactoryLabelProvider { super(adapterFactory); } - /** - * {@inheritDoc} - */ @Override public String getText(final Object object) { String text = null; @@ -62,16 +62,15 @@ public class SessionLabelProvider extends AdapterFactoryLabelProvider { if (item instanceof Resource && safeResource((Resource) item)) { Resource res = (Resource) item; if (res.getURI() != null && res.getURI().lastSegment() != null) { - return URI.decode(res.getURI().lastSegment()) + " - [" + URI.decode(res.getURI().toString()) + "]"; + return MessageFormat.format("{0} - [{1}]", URI.decode(res.getURI().lastSegment()), URI.decode(res.getURI().toString())); //$NON-NLS-1$ } } else { // TODO remove this try/catch once the offline mode - // will - // be supported + // will be supported try { text = super.getText(item); } catch (IllegalStateException e) { - SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, "Error while reading to the model")); + SiriusEditPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SiriusPlugin.ID, Messages.SessionLabelProvider_errorReadingModel)); } } } @@ -95,9 +94,6 @@ public class SessionLabelProvider extends AdapterFactoryLabelProvider { return safe; } - /** - * {@inheritDoc} - */ @Override public Image getImage(final Object object) { Image image = null; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/DeleteRepresentationAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/DeleteRepresentationAction.java index a9826b0321..2db21123fc 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/DeleteRepresentationAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/DeleteRepresentationAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -39,6 +39,7 @@ import org.eclipse.sirius.ui.business.api.session.IEditingSession; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationContainer; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -63,7 +64,7 @@ public class DeleteRepresentationAction extends Action { * the representations to delete */ public DeleteRepresentationAction(Collection<DRepresentation> representations) { - super("Delete", AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/delete.gif")); //$NON-NLS-2$ + super(Messages.DeleteRepresentationAction_name, AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/delete.gif")); //$NON-NLS-1$ this.selectedRepresentations = representations; // Disable the action if the selection is not valid @@ -76,11 +77,11 @@ public class DeleteRepresentationAction extends Action { public void run() { Map<DRepresentation, Session> dRepresentation2Session = getRepresentations(); final Map<Session, Set<DRepresentation>> session2DRepresentations = getSession2DRepresentations(dRepresentation2Session); - String deleteRepresenationDialogTitle = "Delete representation"; - String deletionMessage = "Are you sure you want to delete the selected representation?"; + String deleteRepresenationDialogTitle = Messages.DeleteRepresentationAction_title; + String deletionMessage = Messages.DeleteRepresentationAction_message; if (dRepresentation2Session.size() >= 2) { - deleteRepresenationDialogTitle = "Delete representations"; - deletionMessage = "Are you sure you want to delete the selected representations?"; + deleteRepresenationDialogTitle = Messages.DeleteRepresentationAction_title_plural; + deletionMessage = Messages.DeleteRepresentationAction_message_plural; } try { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); @@ -91,7 +92,7 @@ public class DeleteRepresentationAction extends Action { @Override public void run(final IProgressMonitor monitor) { try { - monitor.beginTask("Associated editor closing", 1); + monitor.beginTask(Messages.DeleteRepresentationAction_closeEditorsTask, 1); for (Entry<Session, Set<DRepresentation>> entry : session2DRepresentations.entrySet()) { Session session = entry.getKey(); Set<DRepresentation> dRepresentations = entry.getValue(); @@ -123,7 +124,8 @@ public class DeleteRepresentationAction extends Action { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { - monitor.beginTask("Representation" + (session2DRepresentations.size() > 1 ? "s" : "") + " deletion", session2DRepresentations.size()); + String taskName = session2DRepresentations.size() > 1 ? Messages.DeleteRepresentationAction_deleteRepresentationTask_plural : Messages.DeleteRepresentationAction_deleteRepresentationTask; + monitor.beginTask(taskName, session2DRepresentations.size()); for (Entry<Session, Set<DRepresentation>> entry : session2DRepresentations.entrySet()) { Session session = entry.getKey(); Set<DRepresentation> dRepresentations = entry.getValue(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/ExtractRepresentationAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/ExtractRepresentationAction.java index f40a03c39c..d6e2da42fd 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/ExtractRepresentationAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/ExtractRepresentationAction.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common.action; +import java.text.MessageFormat; import java.util.Collection; import org.eclipse.emf.ecore.EObject; @@ -24,6 +25,7 @@ import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAutho import org.eclipse.sirius.ui.tools.internal.wizards.ExtractRepresentationsWizard; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationContainer; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -58,7 +60,7 @@ public class ExtractRepresentationAction extends Action { final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/export.gif"); //$NON-NLS-1$ this.setImageDescriptor(descriptor); - this.setText("Extract to ." + SiriusUtil.SESSION_RESOURCE_EXTENSION + " file ..."); + this.setText(MessageFormat.format(Messages.ExtractRepresentationAction_label, SiriusUtil.SESSION_RESOURCE_EXTENSION)); // Disable the action if the selection is not valid if (!isValidSelection()) { @@ -73,7 +75,7 @@ public class ExtractRepresentationAction extends Action { final Shell defaultShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); final WizardDialog dialog = new WizardDialog(defaultShell, wizard); dialog.create(); - dialog.getShell().setText("Extract Representation Wizard"); + dialog.getShell().setText(Messages.ExtractRepresentationAction_dialogTitle); dialog.open(); } @@ -83,9 +85,7 @@ public class ExtractRepresentationAction extends Action { * @return true if the selection is valid */ private boolean isValidSelection() { - boolean anyInvalidExtract = Iterables.any(representations, new Predicate<DRepresentation>() { - @Override public boolean apply(DRepresentation input) { EObject container = input.eContainer(); @@ -98,7 +98,6 @@ public class ExtractRepresentationAction extends Action { return false; } }); - return !anyInvalidExtract; } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/MoveRepresentationAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/MoveRepresentationAction.java index e4b6feb605..5fe930de2b 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/MoveRepresentationAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/MoveRepresentationAction.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common.action; +import java.text.MessageFormat; import java.util.Collection; import org.eclipse.emf.ecore.EObject; @@ -25,6 +26,7 @@ import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.viewpoint.DAnalysis; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationContainer; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.plugin.AbstractUIPlugin; @@ -34,7 +36,7 @@ import com.google.common.collect.Iterables; /** * An action to move selected representations. - * + * * @author <a href="mailto:mickael.lanoe@obeo.fr">Mickael LANOE</a> */ public class MoveRepresentationAction extends Action { @@ -46,7 +48,7 @@ public class MoveRepresentationAction extends Action { /** * Construct a new instance. - * + * * @param session * the current session * @param targetAnalysis @@ -63,7 +65,7 @@ public class MoveRepresentationAction extends Action { final ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SiriusEditPlugin.ID, "/icons/full/others/forward.gif"); //$NON-NLS-1$ this.setImageDescriptor(descriptor); - this.setText("move to " + targetAnalysis.eResource().getURI().toString()); + this.setText(MessageFormat.format(Messages.MoveRepresentationAction_text, targetAnalysis.eResource().getURI().toString())); // Disable the action if the selection is not valid if (!isValidSelection()) { @@ -87,7 +89,7 @@ public class MoveRepresentationAction extends Action { /** * Test if the selection is valid. - * + * * @return true if the selection is valid */ private boolean isValidSelection() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/RenameRepresentationAction.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/RenameRepresentationAction.java index 882c2a8881..f56789c00c 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/RenameRepresentationAction.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/action/RenameRepresentationAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES 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 @@ -23,11 +23,12 @@ import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuth import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.ViewpointPackage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Display; /** * Action to rename one or more Sirius representations. - * + * * @author lredor */ public class RenameRepresentationAction extends Action { @@ -36,20 +37,15 @@ public class RenameRepresentationAction extends Action { /** * Create a new instance. - * + * * @param representations * the representations to delete */ public RenameRepresentationAction(Collection<DRepresentation> representations) { - super("Rename"); + super(Messages.RenameRepresentationAction_name); this.selectedRepresentations = representations; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ @Override public void run() { for (final DRepresentation representation : selectedRepresentations) { @@ -59,7 +55,7 @@ public class RenameRepresentationAction extends Action { /** * Launch a popup to rename the <code>representation</code>. - * + * * @param representation * The representation to rename. */ @@ -80,7 +76,7 @@ public class RenameRepresentationAction extends Action { * Overridden to ask to the {@link IPermissionAuthority} if we can delete * all selected {@link DRepresentation}s, if we can't delete one then the * action is disabled. - * + * * {@inheritDoc} */ @Override diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/AnalysisResourceItemImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/AnalysisResourceItemImpl.java index 330106a28b..750c5d5745 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/AnalysisResourceItemImpl.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/AnalysisResourceItemImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -28,7 +28,7 @@ import com.google.common.collect.Lists; /** * Resource item wrapper class. - * + * * @author mchauvin */ public class AnalysisResourceItemImpl implements AnalysisResourceItem { @@ -47,7 +47,7 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { /** * Construct a new resource item wrapper. - * + * * @param session * the current session * @param resource @@ -61,33 +61,29 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { this.parent = parent; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.ItemWrapper#getWrappedObject() - */ + @Override public Object getWrappedObject() { return resource; } /** * {@inheritDoc} - * + * * @see org.eclipse.sirius.common.ui.tools.api.view.common.item.ItemDecorator#getImage() */ public Image getImage() { - return SiriusEditPlugin.getPlugin().getBundledImage(SESSION_IMAGE); + return SiriusEditPlugin.getPlugin().getBundledImage(AnalysisResourceItemImpl.SESSION_IMAGE); } /** * {@inheritDoc} - * + * * @see org.eclipse.sirius.common.ui.tools.api.view.common.item.ItemDecorator#getText() */ public String getText() { String result = StringUtil.EMPTY_STRING; if (resource.getResourceSet() != null && resource.getURI() != null && resource.getURI().lastSegment() != null) { - result = resource.getURI().lastSegment() + " - [" + resource.getURI() + "]"; + result = resource.getURI().lastSegment() + " - [" + resource.getURI() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ } else { if (resource.getResourceSet() != null && resource.getURI() != null) { result = resource.getURI().toString(); @@ -96,18 +92,11 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { return result; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getSession() - */ + @Override public Option<Session> getSession() { return Options.newSome(session); } - /** - * {@inheritDoc} - */ @Override public int hashCode() { final int prime = 31; @@ -117,9 +106,6 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { return result; } - /** - * {@inheritDoc} - */ @Override public boolean equals(Object obj) { boolean result = false; @@ -145,11 +131,7 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { return result; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getChildren() - */ + @Override public Collection<?> getChildren() { final List<ViewpointItemImpl> all = Lists.newArrayList(); if (resource != null) { @@ -161,11 +143,7 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { return all; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getParent() - */ + @Override public Object getParent() { return parent; } @@ -175,7 +153,7 @@ public class AnalysisResourceItemImpl implements AnalysisResourceItem { * a hierarchy. It will link all created * {@link org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem} * to its parent. - * + * * @param linkChildrenToParent * activate/deactivate the creator mode. */ diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ProjectDependenciesItemImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ProjectDependenciesItemImpl.java index 4f0049026d..362ffa59f0 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ProjectDependenciesItemImpl.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ProjectDependenciesItemImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -23,6 +23,7 @@ import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ui.tools.api.views.common.item.ProjectDependenciesItem; import org.eclipse.sirius.viewpoint.DAnalysisSessionEObject; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.graphics.Image; @@ -32,7 +33,7 @@ import com.google.common.collect.Sets; /** * Display the semantic models associated to the session but not in the current * project. - * + * * @author mchauvin */ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { @@ -44,7 +45,7 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { /** * Construct a new instance. - * + * * @param project * the project */ @@ -54,9 +55,10 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { /** * Get the children of this item. - * + * * @return the children, never <code>null</code> */ + @Override public Collection<?> getChildren() { Collection<Object> children = Sets.newLinkedHashSet(); @@ -102,17 +104,19 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { return deps; } + @Override public String getText() { - return "Project Dependencies"; + return Messages.ProjectDependenciesItemImpl_text; } + @Override public Image getImage() { return SiriusEditPlugin.getPlugin().getBundledImage("icons/obj16/ProjectDependencies.gif"); //$NON-NLS-1$ } /** * Get the parent project. - * + * * @return the parent project, could not be <code>null</code> */ public IProject getProject() { @@ -122,22 +126,20 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { /** * {@inheritDoc} */ + @Override public Object getParent() { return getProject(); } /** * Get the parent {@link ModelingProject} project. - * + * * @return the parent project, could not be <code>null</code> */ public ModelingProject getModelingProject() { return this.project; } - /** - * {@inheritDoc} - */ @Override public int hashCode() { final int prime = 31; @@ -146,9 +148,6 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { return result; } - /** - * {@inheritDoc} - */ @Override public boolean equals(Object obj) { boolean equals = true; @@ -161,8 +160,9 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { } else { ProjectDependenciesItemImpl other = (ProjectDependenciesItemImpl) obj; if (project == null) { - if (other.project != null) + if (other.project != null) { equals = false; + } } else if (!project.equals(other.project)) { equals = false; } @@ -172,9 +172,10 @@ public class ProjectDependenciesItemImpl implements ProjectDependenciesItem { /** * Return the session of the modeling project. - * + * * @return the session of the modeling project */ + @Override public Option<Session> getSession() { if (project != null) { return Options.newSome(project.getSession()); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ResourcesFolderItemImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ResourcesFolderItemImpl.java index 5e8828a840..b90629b1a7 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ResourcesFolderItemImpl.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ResourcesFolderItemImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -15,21 +15,20 @@ import java.util.Collection; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.ui.tools.api.views.common.item.AnalysisResourceItem; +import org.eclipse.sirius.viewpoint.provider.Messages; import com.google.common.collect.Lists; /** * Represents resource folder item in session view. - * + * * @author mchauvin */ public class ResourcesFolderItemImpl extends AbstractFolderItem implements org.eclipse.sirius.ui.tools.api.views.common.item.ResourcesFolderItem { - private static final String FOLDER_LABEL = "Representations per resource"; - /** * Constructor. - * + * * @param session * Session * @param parent @@ -39,20 +38,12 @@ public class ResourcesFolderItemImpl extends AbstractFolderItem implements org.e super(session, parent); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.common.ui.tools.api.view.common.item.ItemDecorator#getText() - */ + @Override public String getText() { - return FOLDER_LABEL; + return Messages.ResourcesFolderItemImpl_text; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getChildren() - */ + @Override public Collection<?> getChildren() { final Collection<AnalysisResourceItem> all = Lists.newArrayList(); final Collection<Resource> resources = session.getAllSessionResources(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointItemImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointItemImpl.java index 3f22f4357a..d55fc35331 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointItemImpl.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointItemImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -27,194 +27,162 @@ import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ui.tools.api.views.common.item.ViewpointItem; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.graphics.Image; /** * Represents viewpoint item in session view. - * + * * @author mchauvin */ -public class ViewpointItemImpl implements ViewpointItem, - Comparable<ViewpointItemImpl>, ItemDecorator, IAdaptable { - - private final Session session; - - private final Viewpoint viewpoint; - - private Resource resource; - - private boolean filterForResource; - - private final Object parent; - - /** - * Constructor. - * - * @param session - * Session - * @param viewpoint - * Sirius - * @param parent - * Parent tree item - */ - public ViewpointItemImpl(final Session session, final Viewpoint viewpoint, - final Object parent) { - this.session = session; - this.viewpoint = viewpoint; - this.parent = parent; - } - - /** - * Constructor. - * - * @param resource - * Resource - * @param session - * Session - * @param viewpoint - * Sirius - * @param parent - * Parent tree item - * @see #ViewpointItem(Session, Viewpoint, Object) - */ - public ViewpointItemImpl(final Session session, final Viewpoint viewpoint, - final Resource resource, final Object parent) { - this(session, viewpoint, parent); - this.resource = resource; - filterForResource = true; - } - - public Object getWrappedObject() { - return viewpoint; - } - - /** - * {@inheritDoc} - */ - public int compareTo(final ViewpointItemImpl o) { - if (viewpoint.getName() != null) { - return viewpoint.getName().compareTo(o.viewpoint.getName()); - } - return 0; - } - - /** - * {@inheritDoc} - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object obj) { - boolean result = false; - if (this == obj) { - result = true; - } else { - if (obj instanceof ViewpointItemImpl) { - final ViewpointItemImpl objItem = (ViewpointItemImpl) obj; - result = compareTo(objItem) == 0 - && objItem.parent.equals(parent); - } - } - return result; - } - - /** - * {@inheritDoc} - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return viewpoint.getName().hashCode() + parent.hashCode(); - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - if (adapter == EObject.class) { - return viewpoint; - } - return null; - } - - /** - * isFilterForResource. - * - * @return the filterForResource - */ - public boolean isFilterForResource() { - return filterForResource; - } - - /** - * Get the resource. - * - * @return the resource - */ - protected Resource getResource() { - return resource; - } - - protected boolean isSafeViewpoint() { - return viewpoint.eResource() != null && !viewpoint.eIsProxy(); - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getSession() - */ - public Option<Session> getSession() { - return Options.newSome(session); - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getChildren() - */ - public Collection<?> getChildren() { - final List<RepresentationDescriptionItemImpl> all = new ArrayList<RepresentationDescriptionItemImpl>(); - if (isSafeViewpoint()) { - for (final RepresentationDescription representationDescription : new ViewpointQuery( - viewpoint).getAllRepresentationDescriptions()) { - if (isFilterForResource()) { - all.add(new RepresentationDescriptionItemImpl(session, - representationDescription, getResource(), this)); - } else { - all.add(new RepresentationDescriptionItemImpl(session, - representationDescription, this)); - } - } - Collections.sort(all); - } - return all; - } - - public void setFilterForResource(boolean filterForResource) { - this.filterForResource = filterForResource; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getParent() - */ - public Object getParent() { - return parent; - } - - public String getText() { - return isSafeViewpoint() ? new IdentifiedElementQuery(viewpoint) - .getLabel() : "\"Not found\""; - } - - public Image getImage() { - return SiriusEditPlugin.getPlugin().getImage( - SiriusEditPlugin.getPlugin().getItemImageDescriptor( - viewpoint)); - } +public class ViewpointItemImpl implements ViewpointItem, Comparable<ViewpointItemImpl>, ItemDecorator, IAdaptable { + + private final Session session; + + private final Viewpoint viewpoint; + + private Resource resource; + + private boolean filterForResource; + + private final Object parent; + + /** + * Constructor. + * + * @param session + * Session + * @param viewpoint + * Sirius + * @param parent + * Parent tree item + */ + public ViewpointItemImpl(final Session session, final Viewpoint viewpoint, final Object parent) { + this.session = session; + this.viewpoint = viewpoint; + this.parent = parent; + } + + /** + * Constructor. + * + * @param resource + * Resource + * @param session + * Session + * @param viewpoint + * Sirius + * @param parent + * Parent tree item + * @see #ViewpointItem(Session, Viewpoint, Object) + */ + public ViewpointItemImpl(final Session session, final Viewpoint viewpoint, final Resource resource, final Object parent) { + this(session, viewpoint, parent); + this.resource = resource; + filterForResource = true; + } + + @Override + public Object getWrappedObject() { + return viewpoint; + } + + @Override + public int compareTo(final ViewpointItemImpl o) { + if (viewpoint.getName() != null) { + return viewpoint.getName().compareTo(o.viewpoint.getName()); + } + return 0; + } + + @Override + public boolean equals(final Object obj) { + boolean result = false; + if (this == obj) { + result = true; + } else { + if (obj instanceof ViewpointItemImpl) { + final ViewpointItemImpl objItem = (ViewpointItemImpl) obj; + result = compareTo(objItem) == 0 && objItem.parent.equals(parent); + } + } + return result; + } + + @Override + public int hashCode() { + return viewpoint.getName().hashCode() + parent.hashCode(); + } + + @Override + @SuppressWarnings("rawtypes") + public Object getAdapter(Class adapter) { + if (adapter == EObject.class) { + return viewpoint; + } + return null; + } + + /** + * isFilterForResource. + * + * @return the filterForResource + */ + public boolean isFilterForResource() { + return filterForResource; + } + + /** + * Get the resource. + * + * @return the resource + */ + protected Resource getResource() { + return resource; + } + + protected boolean isSafeViewpoint() { + return viewpoint.eResource() != null && !viewpoint.eIsProxy(); + } + + @Override + public Option<Session> getSession() { + return Options.newSome(session); + } + + @Override + public Collection<?> getChildren() { + final List<RepresentationDescriptionItemImpl> all = new ArrayList<RepresentationDescriptionItemImpl>(); + if (isSafeViewpoint()) { + for (final RepresentationDescription representationDescription : new ViewpointQuery(viewpoint).getAllRepresentationDescriptions()) { + if (isFilterForResource()) { + all.add(new RepresentationDescriptionItemImpl(session, representationDescription, getResource(), this)); + } else { + all.add(new RepresentationDescriptionItemImpl(session, representationDescription, this)); + } + } + Collections.sort(all); + } + return all; + } + + public void setFilterForResource(boolean filterForResource) { + this.filterForResource = filterForResource; + } + + @Override + public Object getParent() { + return parent; + } + + @Override + public String getText() { + return isSafeViewpoint() ? new IdentifiedElementQuery(viewpoint).getLabel() : Messages.ViewpointItemImpl_notFoundLabel; + } + + @Override + public Image getImage() { + return SiriusEditPlugin.getPlugin().getImage(SiriusEditPlugin.getPlugin().getItemImageDescriptor(viewpoint)); + } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointsFolderItemImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointsFolderItemImpl.java index 26f61149dc..44e3d343fa 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointsFolderItemImpl.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/item/ViewpointsFolderItemImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010, 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -16,20 +16,19 @@ import java.util.List; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import com.google.common.collect.Lists; /** * Represents viewpoint folder item in session view. - * + * * @author mchauvin */ public class ViewpointsFolderItemImpl extends AbstractFolderItem implements org.eclipse.sirius.ui.tools.api.views.common.item.ViewpointsFolderItem { - private static final String FOLDER_LABEL = "Representations per category"; - /** * Constructor. - * + * * @param session * Session * @param parent @@ -39,20 +38,12 @@ public class ViewpointsFolderItemImpl extends AbstractFolderItem implements org. super(session, parent); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.common.ui.tools.api.view.common.item.ItemDecorator#getText() - */ + @Override public String getText() { - return FOLDER_LABEL; + return Messages.ViewpointsFolderItemImpl_representationsPerCategory_title; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.views.common.item.CommonSessionItem#getChildren() - */ + @Override public Collection<?> getChildren() { final List<ViewpointItemImpl> all = Lists.newArrayList(); for (final Viewpoint viewpoint : session.getSelectedViewpoints(false)) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/OpenRepresentationsFileJob.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/OpenRepresentationsFileJob.java index 57d921f6b4..f6cd3e229c 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/OpenRepresentationsFileJob.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/OpenRepresentationsFileJob.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -12,6 +12,7 @@ package org.eclipse.sirius.ui.tools.internal.views.common.modelingproject; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.text.MessageFormat; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -45,6 +46,7 @@ import org.eclipse.sirius.ui.business.api.session.SessionHelper; import org.eclipse.sirius.ui.business.api.session.SessionUIManager; import org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; @@ -59,14 +61,14 @@ import com.google.common.collect.Lists; * the referenced resource). Warning before calling this job you must call * waitOtherJobs methods to ensure that there is no job of this kind currently * running. - * + * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * The default label for the job that open a representations file. */ - public static final String JOB_LABEL = "Loading models"; + public static final String JOB_LABEL = Messages.OpenRepresentationsFileJob_label; private static final String QUOTE = "\""; //$NON-NLS-1$ @@ -85,26 +87,26 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Constructor to open only one representations file. - * + * * @param representationsFileURI * The URI of the representations file to open. */ public OpenRepresentationsFileJob(final URI representationsFileURI) { - super(JOB_LABEL); + super(OpenRepresentationsFileJob.JOB_LABEL); this.representationsFilesURIs.add(representationsFileURI); } /** * Constructor to open several representations files. - * + * * @param elements * A list of URIs of the representations files to open or a list * of the modeling projects to initialize and open. */ public OpenRepresentationsFileJob(List<? extends Object> elements) { - super(JOB_LABEL); + super(OpenRepresentationsFileJob.JOB_LABEL); if (!(Iterators.all(elements.iterator(), Predicates.instanceOf(URI.class)) || Iterators.all(elements.iterator(), Predicates.instanceOf(ModelingProject.class)))) { - throw new IllegalArgumentException("This list must be a list of URI or a list of ModelingProject."); + throw new IllegalArgumentException(Messages.OpenRepresentationsFileJob_errorInvalidInputList); } Iterators.addAll(this.representationsFilesURIs, Iterators.filter(elements.iterator(), URI.class)); Iterators.addAll(this.modelingProjects, Iterators.filter(elements.iterator(), ModelingProject.class)); @@ -112,7 +114,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Launch this job when all other openRepresentationFile's job are finished. - * + * * @param representationsFileURI * The URI of the representations file to open. * @param user @@ -132,7 +134,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Launch this job when all other openRepresentationFile's job are finished. - * + * * @param elements * A list of URIs of the representations files to open or a list * of the modeling projects to initialize and open. @@ -142,7 +144,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { */ public static void scheduleNewWhenPossible(List<? extends Object> elements, boolean user) { if (!(Iterators.all(elements.iterator(), Predicates.instanceOf(URI.class)) || Iterators.all(elements.iterator(), Predicates.instanceOf(ModelingProject.class)))) { - throw new IllegalArgumentException("This list must be a list of URI or a list of ModelingProject."); + throw new IllegalArgumentException(Messages.OpenRepresentationsFileJob_errorInvalidInputList); } // Just wait other job if some are already in progress @@ -155,18 +157,13 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { job.schedule(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) - */ @Override public IStatus runInWorkspace(IProgressMonitor monitor) { IStatus initializationStatus = Status.OK_STATUS; List<IStatus> openingStatuses = Lists.newArrayList(); try { - monitor.beginTask("Loading models", 11); - monitor.subTask("Initialize modeling projects"); + monitor.beginTask(Messages.OpenRepresentationsFileJob_loadingModelsTask, 11); + monitor.subTask(Messages.OpenRepresentationsFileJob_initModelingProjectsTask); if (!modelingProjects.isEmpty()) { // Initialize the modeling projects before open the main // representations files. @@ -209,14 +206,14 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { SiriusPlugin.getDefault().getLog().log(e.getStatus()); } - subMonitor.subTask("Loading representations file " + QUOTE + representationsFileURI.lastSegment() + QUOTE); + subMonitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_loadingRepresentationFileTask, representationsFileURI.lastSegment())); final Set<Session> sessions = performOpenSession(representationsFileURI, new SubProgressMonitor(subMonitor, 90)); if (sessions.isEmpty()) { subMonitor.worked(10); String errorMessage = logLoadingProblem(project, representationsFileURI, null); - openingStatuses.add(new Status(IStatus.ERROR, SiriusEditPlugin.ID, IStatus.OK, errorMessage, null)); //$NON-NLS-1$) + openingStatuses.add(new Status(IStatus.ERROR, SiriusEditPlugin.ID, IStatus.OK, errorMessage, null)); } else { - subMonitor.subTask("Opening the startup representations of " + QUOTE + representationsFileURI.lastSegment() + QUOTE); + subMonitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_openingStartRepresentationTask, representationsFileURI.lastSegment())); // Open the startup representations of each session for (final Session session : sessions) { SessionHelper.openStartupRepresentations(session, new SubProgressMonitor(subMonitor, 10 / sessions.size())); @@ -242,7 +239,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { if (allStatuses.size() == 1) { result = allStatuses.get(0); } else if (allStatuses.size() > 1) { - result = new MultiStatus(SiriusEditPlugin.ID, IStatus.ERROR, allStatuses.toArray(new IStatus[0]), "Several modeling projects are invalid or can not be opened.", null); + result = new MultiStatus(SiriusEditPlugin.ID, IStatus.ERROR, allStatuses.toArray(new IStatus[0]), Messages.OpenRepresentationsFileJob_invalidModelingProjectsError, null); } return result; @@ -251,7 +248,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Log loading problem (Add a marker on this project, change valid status of * this modeling project, clean the cache of the ModelingProjectManager). - * + * * @param project * The project concerned by this problem. * @param representationsFileURI @@ -264,16 +261,16 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { String message = ""; //$NON-NLS-1$ if (project != null) { boolean isModelingProject = ModelingProject.hasModelingProjectNature(project); - if (isModelingProject) { - message += "The modeling project \"" + project.getName() + "\" is invalid: Problem during loading models"; + final String errorDetail; + if (exception != null) { + errorDetail = exception.getCause() != null ? exception.getCause().getMessage() : exception.getMessage(); } else { - message += "The representations file \"" + representationsFileURI.toPlatformString(true) + "\" is invalid: Problem during loading models"; + errorDetail = Messages.OpenRepresentationsFileJob_loadingProblem_defaultErrorDetail; } - // Add a marker on this project - if (exception != null) { - message += ": " + (exception.getCause() != null ? exception.getCause().getMessage() : exception.getMessage()); + if (isModelingProject) { + message = MessageFormat.format(Messages.OpenRepresentationsFileJob_loadingProblem_modelingProject, project.getName(), errorDetail); } else { - message += " (see Error Log for more details)"; + message = MessageFormat.format(Messages.OpenRepresentationsFileJob_loadingProblem_representationFile, representationsFileURI.toPlatformString(true), errorDetail); } Option<IMarker> optionalMarker = MarkerUtil.addMarkerFor(project, message, IMarker.SEVERITY_ERROR, ModelingMarker.MARKER_TYPE); @@ -293,7 +290,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Open session. - * + * * @param representationsFileURI * The URI of the representations file corresponding to the * session to opened. @@ -302,14 +299,14 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { * @return Resource associated to session. */ public Set<Session> performOpenSession(URI representationsFileURI, IProgressMonitor monitor) { - monitor.beginTask("Load representations and models", 16); + monitor.beginTask(Messages.OpenRepresentationsFileJob_loadRepresentationsTask, 16); Set<Session> openedSessions = new HashSet<Session>(); if (SiriusUtil.SESSION_RESOURCE_EXTENSION.equals(representationsFileURI.fileExtension())) { monitor.worked(1); Session session = SessionManager.INSTANCE.getSession(representationsFileURI, new SubProgressMonitor(monitor, 10)); // Open the session if needed (load the referenced models by // a ResolveAll call) - monitor.subTask("Loading referenced models of " + QUOTE + representationsFileURI.lastSegment() + QUOTE); + monitor.subTask(MessageFormat.format(Messages.OpenRepresentationsFileJob_loadReferencedModelsTask, representationsFileURI.lastSegment())); if (session != null) { if (!session.isOpen()) { session.open(new SubProgressMonitor(monitor, 4)); @@ -339,10 +336,11 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { * called from UI Thread. */ public static void waitOtherJobs() { - if (shouldWaitOtherJobs()) { + if (OpenRepresentationsFileJob.shouldWaitOtherJobs()) { try { if (Display.getCurrent() != null) { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InterruptedException { Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, monitor); } @@ -351,7 +349,8 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { Job.getJobManager().join(AbstractRepresentationsFileJob.FAMILY, new NullProgressMonitor()); } } catch (InvocationTargetException e) { - StatusManager.getManager().handle(new Status(IStatus.ERROR, SiriusEditPlugin.ID, IStatus.OK, getLocalizedMessage(e), getCause(e))); + StatusManager.getManager() + .handle(new Status(IStatus.ERROR, SiriusEditPlugin.ID, IStatus.OK, OpenRepresentationsFileJob.getLocalizedMessage(e), OpenRepresentationsFileJob.getCause(e))); } catch (InterruptedException e) { // Do nothing; } @@ -361,7 +360,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Check if other jobs of this kind are running. This method must be called * from UI Thread. - * + * * @return true if other jobs of this kind are running. */ public static boolean shouldWaitOtherJobs() { @@ -373,7 +372,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { * Returns a localized message describing the given exception. If the given * exception does not have a localized message, this returns the string * "An error occurred". - * + * * @param exception * The exception to deal with * @return The message @@ -389,7 +388,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { CoreException ce = (CoreException) exception; return ce.getStatus().getMessage(); } else { - message = "An unexpected exception was thrown."; + message = Messages.OpenRepresentationsFileJob_unexpectedException; } } @@ -398,7 +397,7 @@ public class OpenRepresentationsFileJob extends AbstractRepresentationsFileJob { /** * Returns the cause of the given exception. - * + * * @param exception * The exception to deal with * @return the cause of the given exception. diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java index 0b9be21f19..03bcfb5b9c 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/manager/ModelingProjectManagerImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.manager; +import java.text.MessageFormat; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -50,6 +51,7 @@ import org.eclipse.sirius.tools.api.command.semantic.AddSemanticResourceCommand; import org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager; import org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.ModelingProjectFileQuery; import org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import com.google.common.base.Predicate; @@ -60,7 +62,7 @@ import com.google.common.collect.Sets; /** * A manager for modeling projects. - * + * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ public class ModelingProjectManagerImpl implements ModelingProjectManager { @@ -69,12 +71,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { private static final String VIEWPOINT_MODELING_PROJECT_NATURE_ID = "fr.obeo.dsl.viewpoint.nature.modelingproject"; //$NON-NLS-1$ private final SessionManagerListener sessionManagerListener = new SessionManagerListener.Stub() { - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.api.session.SessionManagerListener#notify(org.eclipse.sirius.business.api.session.Session, - * int) - */ + @Override public void notify(Session updated, int notification) { if (notification == SessionListener.OPENING) { // No need to at it again to the sessionFileLoading list because @@ -87,6 +84,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { }; private Predicate<URI> isAlreadyLoadedPredicate = new Predicate<URI>() { + @Override public boolean apply(URI representationsFileURI) { return isAlreadyLoaded(representationsFileURI); } @@ -107,27 +105,19 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { /** * Default initialization of a {@link ModelingProjectManagerImpl}. - * + * * @return a new instance of {@link ModelingProjectManagerImpl}. */ public static ModelingProjectManagerImpl init() { return new ModelingProjectManagerImpl(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager#loadAndOpenRepresentationsFile(org.eclipse.emf.common.util.URI) - */ + @Override public void loadAndOpenRepresentationsFile(final URI representationsFileURI) { loadAndOpenRepresentationsFiles(Lists.newArrayList(representationsFileURI)); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager#loadAndOpenRepresentationsFiles(java.util.List) - */ + @Override public void loadAndOpenRepresentationsFiles(final List<URI> representationsFilesURIs) { // Add the specific sessions listener (if not already added). SessionManager.INSTANCE.addSessionsListener(sessionManagerListener); @@ -153,14 +143,13 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { /** * Check if the representations file is already loaded (known by * SessionManager). - * + * * @param representationsFileURI * The URI of the representations file. * @return true if already loaded, false otherwise */ private boolean isAlreadyLoaded(URI representationsFileURI) { - for (Iterator<Session> iterator = Collections.unmodifiableCollection(SessionManager.INSTANCE.getSessions()).iterator(); iterator.hasNext(); /* */) { - Session session = iterator.next(); + for (Session session : Collections.unmodifiableCollection(SessionManager.INSTANCE.getSessions())) { if (representationsFileURI.equals(session.getSessionResource().getURI())) { return true; } @@ -168,31 +157,24 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { return false; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager#clearCache(org.eclipse.emf.common.util.URI) - */ + @Override public void clearCache(URI representationsFileURI) { sessionFileLoading.remove(representationsFileURI); } - /** - * {@inheritDoc} - */ + @Override public IProject createNewModelingProject(String projectName, boolean createAndOpenBlankRepresentationsFile, IProgressMonitor monitor) throws CoreException { return createNewModelingProject(projectName, null, createAndOpenBlankRepresentationsFile, monitor); } - /** - * {@inheritDoc} - */ + @Override public IProject createNewModelingProject(final String projectName, final IPath projectLocationPath, final boolean createAndOpenBlankRepresentationsFile, IProgressMonitor monitor) throws CoreException { final IWorkspaceRunnable create = new IWorkspaceRunnable() { + @Override public void run(final IProgressMonitor monitor) throws CoreException { try { - monitor.beginTask("Modeling Project creation : " + projectName, 3); + monitor.beginTask(MessageFormat.format(Messages.ModelingProjectManagerImpl_createModelingProjectTask, projectName), 3); final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (!project.exists()) { final IProjectDescription desc = project.getWorkspace().newProjectDescription(projectName); @@ -204,13 +186,13 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { String[] natures = { ModelingProject.NATURE_ID }; desc.setNatureIds(natures); - monitor.subTask("Create project"); + monitor.subTask(Messages.ModelingProjectManagerImpl_createProjectTask); project.create(desc, new SubProgressMonitor(monitor, 1)); - monitor.subTask("Open project"); + monitor.subTask(Messages.ModelingProjectManagerImpl_openProjectTask); project.open(new SubProgressMonitor(monitor, 1)); if (createAndOpenBlankRepresentationsFile) { - monitor.subTask("Create local representations file"); + monitor.subTask(Messages.ModelingProjectManagerImpl_createRepresentationFileTask); createLocalRepresentationsFile(project, new SubProgressMonitor(monitor, 1)); } } @@ -226,14 +208,13 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); } - /** - * {@inheritDoc} - */ + @Override public void convertToModelingProject(final IProject project, IProgressMonitor monitor) throws CoreException { final IWorkspaceRunnable create = new IWorkspaceRunnable() { + @Override public void run(final IProgressMonitor monitor) throws CoreException { try { - monitor.beginTask("Conversion to Modeling Project", 1); + monitor.beginTask(Messages.ModelingProjectManagerImpl_convertToModelingProjectTask, 1); doAddModelingNature(project, new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); @@ -253,11 +234,10 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { return currentJob != null && currentJob.getRule() != null; } - /** - * {@inheritDoc} - */ + @Override public void removeModelingNature(final IProject project, IProgressMonitor monitor) throws CoreException { final IWorkspaceRunnable create = new IWorkspaceRunnable() { + @Override public void run(final IProgressMonitor monitor) throws CoreException { doRemoveModelingNature(project, monitor); } @@ -265,9 +245,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { ResourcesPlugin.getWorkspace().run(create, monitor); } - /** - * {@inheritDoc} - */ + @Override public void createLocalRepresentationsFile(IProject project, IProgressMonitor monitor) throws CoreException { URI representationsURI = URI.createPlatformResourceURI(project.getFullPath().append(ModelingProject.DEFAULT_REPRESENTATIONS_FILE_NAME).toString(), true); @@ -279,7 +257,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { /** * Add the modeling nature. Open or create the main aird file. Look for * semantic resources to add. - * + * * @param project * the project to convert. * @param monitor @@ -290,14 +268,14 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { */ protected void doAddModelingNature(IProject project, IProgressMonitor monitor) throws CoreException { try { - monitor.beginTask("Add Modeling Project nature", 3); + monitor.beginTask(Messages.ModelingProjectManagerImpl_addingModelingNatureTask, 3); IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); - if (description.hasNature(VIEWPOINT_MODELING_PROJECT_NATURE_ID)) { + if (description.hasNature(ModelingProjectManagerImpl.VIEWPOINT_MODELING_PROJECT_NATURE_ID)) { // Replace the old Viewpoint nature for (int i = 0; i < natures.length; i++) { - if (VIEWPOINT_MODELING_PROJECT_NATURE_ID.equals(natures[i])) { + if (ModelingProjectManagerImpl.VIEWPOINT_MODELING_PROJECT_NATURE_ID.equals(natures[i])) { natures[i] = ModelingProject.NATURE_ID; } } @@ -352,7 +330,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { /** * Remove the modeling nature. - * + * * @param project * the project to convert. * @param monitor @@ -363,7 +341,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { */ protected void doRemoveModelingNature(IProject project, IProgressMonitor monitor) throws CoreException { try { - monitor.beginTask("Remove Modeling Project nature", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.ModelingProjectManagerImpl_removingModelingNatureTask, IProgressMonitor.UNKNOWN); IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); for (int i = 0; i < natures.length; ++i) { @@ -388,7 +366,7 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { private void addSemanticResources(IContainer container, Session session, IProgressMonitor monitor) throws CoreException { try { - monitor.beginTask("Semantic resources addition", 1); + monitor.beginTask(Messages.ModelingProjectManagerImpl_semanticResourcesAdditionTask, 1); Command semanticResourcesAdditionCommand = getSemanticResourcesAdditionCommand(container, session, monitor); session.getTransactionalEditingDomain().getCommandStack().execute(semanticResourcesAdditionCommand); } finally { @@ -417,12 +395,12 @@ public class ModelingProjectManagerImpl implements ModelingProjectManager { /** * Check if file is a loadable model. - * + * * @param file * IFile * @param session * Session - * + * * @return <code>true</code> if it is, <code>false</code> otherwise */ private boolean isLoadableModel(IFile file, Session session) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/model/ModelingModelProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/model/ModelingModelProvider.java index 588faaf139..e45e1d2b48 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/model/ModelingModelProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/modelingproject/model/ModelingModelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.model; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -34,10 +35,11 @@ import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionStatus; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * Modeling-aware model provider. - * + * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ public class ModelingModelProvider extends ModelProvider { @@ -52,9 +54,7 @@ public class ModelingModelProvider extends ModelProvider { // Used by the runtime } - /** - * {@inheritDoc} - */ + @Override public ResourceMapping[] getMappings(final IResource resource, final ResourceMappingContext context, final IProgressMonitor monitor) throws CoreException { ResourceMapping[] result = null; if (resource instanceof IProject) { @@ -75,12 +75,6 @@ public class ModelingModelProvider extends ModelProvider { return result; } - /** - * {@inheritDoc} - * - * @see org.eclipse.core.resources.mapping.ModelProvider#validateChange(org.eclipse.core.resources.IResourceDelta, - * org.eclipse.core.runtime.IProgressMonitor) - */ @Override public IStatus validateChange(IResourceDelta delta, IProgressMonitor monitor) { IStatus result = null; @@ -89,22 +83,22 @@ public class ModelingModelProvider extends ModelProvider { ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); delta.accept(visitor); if (visitor.getProjectContainingSessionToSaveToDelete().size() == 1) { - result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, "This modeling project contains unsaved data. This data will be lost."); + result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, Messages.ModelingModelProvider_satusUnsavedDataWillBeLost); } else if (visitor.getProjectContainingSessionToSaveToDelete().size() > 1) { - result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, "Some modeling projects (" - + getProjectsName(visitor.getProjectContainingSessionToSaveToDelete()) + ") contain unsaved data. This data will be lost."); + result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, MessageFormat.format( + Messages.ModelingModelProvider_satusUnsaveDataWillBeLostWithProjectNames, getProjectsName(visitor.getProjectContainingSessionToSaveToDelete()))); } else if (visitor.getMainRepresentationsFilesToDelete().size() == 1) { - result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, "Deletion of the main representations file of \"" - + visitor.getMainRepresentationsFilesToDelete().get(0).getProject().getName() + "\" will invalidate it."); + result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, MessageFormat.format( + Messages.ModelingModelProvider_mainRepresentationFileDeleted, visitor.getMainRepresentationsFilesToDelete().get(0).getProject().getName())); } else if (visitor.getMainRepresentationsFilesToDelete().size() > 1) { - result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, "Deletion of the main representations files of some modeling projects (" - + getFilesProjectName(visitor.getMainRepresentationsFilesToDelete()) + ") will invalidate them."); + result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, MessageFormat.format( + Messages.ModelingModelProvider_mainRepresentationFilesOfSomeProjectsDeleted, getFilesProjectName(visitor.getMainRepresentationsFilesToDelete()))); } else if (visitor.getRepresentationsFileToAddOnValidModelingProject().size() == 1) { - result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, "Add another representations file to \"" - + visitor.getRepresentationsFileToAddOnValidModelingProject().get(0).getProject().getName() + "\" may invalidate it."); + result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, MessageFormat.format( + Messages.ModelingModelProvider_addAnotherRepresentationFile, visitor.getRepresentationsFileToAddOnValidModelingProject().get(0).getProject().getName())); } else if (visitor.getRepresentationsFileToAddOnValidModelingProject().size() > 1) { - result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, "Add another representations file to " - + getFilesProjectName(visitor.getRepresentationsFileToAddOnValidModelingProject()) + " may invalidate them."); + result = new ModelStatus(IStatus.ERROR, SiriusPlugin.ID, ModelingModelProvider.MODELING_MODEL_PROVIDER_ID, MessageFormat.format( + Messages.ModelingModelProvider_addAnotherRepresentationFileSeveralProjects, getFilesProjectName(visitor.getRepresentationsFileToAddOnValidModelingProject()))); } } catch (CoreException e) { /* do nothing */ @@ -119,7 +113,7 @@ public class ModelingModelProvider extends ModelProvider { /** * Return a String representing the name of this projects separated by a * comma. - * + * * @param projects * the list of projects * @return a String representing the name of this projects separated by a @@ -140,7 +134,7 @@ public class ModelingModelProvider extends ModelProvider { /** * Return a String representing the name of the project of this files * separated by a comma. - * + * * @param files * the list of files * @return a String representing the name of this projects separated by a @@ -166,7 +160,7 @@ public class ModelingModelProvider extends ModelProvider { * <LI>Add of representations file in a valid modeling project (already with * a main representations file).</LI> * </UL> - * + * * @author lredor. */ private final class ResourceDeltaVisitor implements IResourceDeltaVisitor { @@ -179,6 +173,7 @@ public class ModelingModelProvider extends ModelProvider { /** * {@inheritDoc} */ + @Override public boolean visit(IResourceDelta delta) throws CoreException { boolean visitChildren = true; IResource res = delta.getResource(); @@ -193,7 +188,7 @@ public class ModelingModelProvider extends ModelProvider { /** * Visits the given resource delta that corresponds to a project. - * + * * @param delta * The given resource delta * @param project @@ -226,7 +221,7 @@ public class ModelingModelProvider extends ModelProvider { /** * Visits the given resource delta that corresponds to a file. - * + * * @param delta * The given resource delta * @param file diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/OpenSessionOnExpandListener.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/OpenSessionOnExpandListener.java index dee81dddf5..0ac53b0846 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/OpenSessionOnExpandListener.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/OpenSessionOnExpandListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -12,6 +12,7 @@ package org.eclipse.sirius.ui.tools.internal.views.common.navigator; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.text.MessageFormat; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -28,6 +29,7 @@ import org.eclipse.sirius.business.api.modelingproject.ModelingProject; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager; import org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.progress.UIJob; /** @@ -35,25 +37,17 @@ import org.eclipse.ui.progress.UIJob; * When user expands a modeling project, the representations file is opened * "silently". And when user expands the representations file, if the "silently" * opening is not finished, it become blocker. - * + * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ public class OpenSessionOnExpandListener implements ITreeViewerListener { - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent) - */ + @Override public void treeCollapsed(TreeExpansionEvent event) { // Do nothing } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent) - */ + @Override public void treeExpanded(final TreeExpansionEvent event) { if (event.getElement() instanceof IProject) { IProject projectExpanded = (IProject) event.getElement(); @@ -90,9 +84,9 @@ public class OpenSessionOnExpandListener implements ITreeViewerListener { /** * {@link UIJob} to expand the loaded file - * + * * @author mporhel - * + * */ private class ExpandAgainJob extends UIJob { @@ -101,12 +95,12 @@ public class OpenSessionOnExpandListener implements ITreeViewerListener { private final Object itemToExpand; /** - * + * * @param viewer * @param itemToExpand */ public ExpandAgainJob(AbstractTreeViewer viewer, IFile itemToExpand) { - super("Expand " + itemToExpand.getName()); + super(MessageFormat.format(Messages.OpenSessionOnExpandListener_expandJob, itemToExpand.getName())); this.viewer = viewer; this.itemToExpand = itemToExpand; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java index e4fa1fe21e..0959005d2d 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonContentProvider.java @@ -62,6 +62,7 @@ import org.eclipse.sirius.viewpoint.DAnalysisSessionEObject; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.ViewpointPackage; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IMemento; @@ -739,7 +740,7 @@ public class SiriusCommonContentProvider implements ICommonContentProvider { private void postAsyncUpdate(final Display display) { if (updateJob == null) { - updateJob = new UIJob(display, "Async viewer updates") { + updateJob = new UIJob(display, Messages.SiriusCommonContentProvider_asyncUpdateJob) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (isViewerBusy()) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java index e7d7b9846e..3e15cfa256 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/SiriusCommonLabelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common.navigator; +import java.text.MessageFormat; import java.util.Collections; import java.util.List; @@ -42,6 +43,7 @@ import org.eclipse.sirius.ui.tools.internal.views.common.FileSessionFinder; import org.eclipse.sirius.ui.tools.internal.views.common.SessionLabelProvider; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; @@ -58,9 +60,9 @@ import com.google.common.collect.Lists; /** * Sirius label provider for common navigator. - * + * * @author mporhel - * + * */ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorProvider { @@ -80,9 +82,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr sessionLabelProvider = new SessionLabelProvider(ViewHelper.INSTANCE.createAdapterFactory()); } - /** - * {@inheritDoc} - */ + @Override public Image getImage(Object element) { Image img = null; if (!(element instanceof IResource) && sessionLabelProvider != null) { @@ -97,7 +97,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr // type of representation. if (img != null && isDanglingRepresentation(element)) { DSemanticDecorator dSemanticDecorator = getDSemanticDecorator(element); - String key = dSemanticDecorator.eClass().getName() + "_disabled"; + String key = MessageFormat.format(Messages.SiriusCommonLabelProvider_eClassDisabled, dSemanticDecorator.eClass().getName()); Image disabledImage = SiriusEditPlugin.getPlugin().getImageRegistry().get(key); if (disabledImage == null) { ImageDescriptor desc = ImageDescriptor.createFromImage(img); @@ -128,7 +128,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr String fileExtension = file.getFileExtension(); // Create a key to store/restore the image in image registry of // SiriusEditPlugin - String imgKey = fileExtension + "Decorated"; + String imgKey = fileExtension + "Decorated"; //$NON-NLS-1$ // Get the existing image (if any) img = SiriusEditPlugin.getPlugin().getImageRegistry().get(imgKey); // If the image has already been computed, use it. @@ -142,7 +142,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr if (imageDescriptor != null) { // Add an overlay with the "Sirius Modeling" overlay ImageDescriptor[] imageDescriptors = new ImageDescriptor[5]; - imageDescriptors[IDecoration.TOP_RIGHT] = SIRIUS_MODELING_OVERLAY_DESC; + imageDescriptors[IDecoration.TOP_RIGHT] = SiriusCommonLabelProvider.SIRIUS_MODELING_OVERLAY_DESC; img = new DecorationOverlayIcon(imageDescriptor.createImage(), imageDescriptors).createImage(); SiriusEditPlugin.getPlugin().getImageRegistry().put(imgKey, img); } @@ -170,16 +170,14 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr return semDec; } - /** - * {@inheritDoc} - */ + @Override public String getText(Object element) { String text = null; if (element instanceof IProject) { IProject project = (IProject) element; Option<ModelingProject> modelingProject = ModelingProject.asModelingProject(project); - if (modelingProject.some() && shoudlShowSessionDirtyStatus(modelingProject.get().getSession())) { - text = DIRTY + project.getName(); + if (modelingProject.some() && SiriusCommonLabelProvider.shoudlShowSessionDirtyStatus(modelingProject.get().getSession())) { + text = SiriusCommonLabelProvider.DIRTY + project.getName(); } } else if (element instanceof IFile) { text = doGetFileText((IFile) element); @@ -212,8 +210,8 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr List<Session> openedSessions = getOpenSessions(file); if (openedSessions.size() == 1) { // legacy case - boolean dirty = shoudlShowSessionDirtyStatus(openedSessions.iterator().next()); - text = dirty ? DIRTY + file.getName() : file.getName(); + boolean dirty = SiriusCommonLabelProvider.shoudlShowSessionDirtyStatus(openedSessions.iterator().next()); + text = dirty ? SiriusCommonLabelProvider.DIRTY + file.getName() : file.getName(); } } @@ -221,8 +219,8 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr // Transient case Iterable<Session> transientSessions = Iterables.filter(getOpenSessions(file), new SiriusCommonContentProvider.TransientSessionPredicate()); if (Iterables.size(transientSessions) == 1) { - boolean dirty = shoudlShowSessionDirtyStatus(transientSessions.iterator().next()); - text = dirty ? DIRTY + file.getName() : file.getName(); + boolean dirty = SiriusCommonLabelProvider.shoudlShowSessionDirtyStatus(transientSessions.iterator().next()); + text = dirty ? SiriusCommonLabelProvider.DIRTY + file.getName() : file.getName(); } } } @@ -238,6 +236,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr private List<Session> getOpenSessions(IFile file) { return Lists.newArrayList(Iterables.filter(FileSessionFinder.getSelectedSessions(Collections.singletonList(file)), new Predicate<Session>() { + @Override public boolean apply(Session input) { return input.isOpen(); } @@ -248,7 +247,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr * Test if the "*" prefix should be displayed : the session should be dirty * and if the preference DesignerUIPreferencesKeys.PREF_SAVE_WHEN_NO_EDITOR * value is true, it should be displayed only when there is no editor. - * + * * @param session * the session to test. * @return true if the dirty decorator @@ -271,34 +270,26 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr return false; } - /** - * {@inheritDoc} - */ + @Override public void addListener(ILabelProviderListener listener) { if (sessionLabelProvider != null) { sessionLabelProvider.addListener(listener); } } - /** - * {@inheritDoc} - */ + @Override public void removeListener(ILabelProviderListener listener) { if (sessionLabelProvider != null) { sessionLabelProvider.removeListener(listener); } } - /** - * {@inheritDoc} - */ + @Override public boolean isLabelProperty(Object element, String property) { return true; } - /** - * {@inheritDoc} - */ + @Override public Color getForeground(final Object element) { Color foreground = null; @@ -329,7 +320,7 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr /** * Check that the given object is in a modeling project. - * + * * @param object * the object to check. * @return true if the object is in a modeling project. @@ -356,16 +347,12 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr return false; } - /** - * {@inheritDoc} - */ + @Override public Color getBackground(Object element) { return null; } - /** - * {@inheritDoc} - */ + @Override public void dispose() { if (sessionLabelProvider != null) { sessionLabelProvider.dispose(); @@ -373,28 +360,20 @@ public class SiriusCommonLabelProvider implements ICommonLabelProvider, IColorPr } } - /** - * {@inheritDoc} - */ + @Override public void saveState(IMemento aMemento) { } - /** - * {@inheritDoc} - */ + @Override public void restoreState(IMemento aMemento) { } - /** - * {@inheritDoc} - */ + @Override public String getDescription(Object anElement) { return null; } - /** - * {@inheritDoc} - */ + @Override public void init(ICommonContentExtensionSite aConfig) { } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/FilteredCommonTree.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/FilteredCommonTree.java index 2cb0364390..45dc4c0410 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/FilteredCommonTree.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/common/navigator/filter/FilteredCommonTree.java @@ -13,6 +13,8 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.common.navigator.filter; +import java.text.MessageFormat; + import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -28,6 +30,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.osgi.util.NLS; import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.TooltipAwareNavigatorDecoratingLabelProvider; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.accessibility.ACC; @@ -76,9 +79,9 @@ import org.eclipse.ui.progress.WorkbenchJob; * A simple control that provides a text widget and a common viewer (the Tree * Viewer for the Common Navigator). The contents of the text widget are used to * drive a PatternFilter that is on the viewer. - * + * * This control is inspired from the FilteredTree control. - * + * * @see org.eclipse.ui.dialogs.FilteredTree * @see PatternFilter */ @@ -128,7 +131,7 @@ public class FilteredCommonTree extends Composite { * <p> * <strong>Note:</strong> This is only used if the new look is chosen. * </p> - * + * * @since 0.9.0 */ protected Control clearButtonControl; @@ -153,7 +156,7 @@ public class FilteredCommonTree extends Composite { /** * The parent composite of the filtered tree. - * + * * @since 0.9.0 */ protected Composite parent; @@ -163,14 +166,14 @@ public class FilteredCommonTree extends Composite { * default is to show these controls. This can be overridden by providing a * setting in the product configuration file. The setting to add to not show * these controls is: - * + * * org.eclipse.ui/SHOW_FILTERED_TEXTS=false */ protected boolean showFilterControls; /** * The tree composite of this control. - * + * * @since 0.9.0 */ protected Composite treeComposite; @@ -194,7 +197,7 @@ public class FilteredCommonTree extends Composite { /** * Tells whether to use the pre 3.5 or the new look. - * + * * @since 0.9.0 */ private boolean useNewLook; @@ -209,17 +212,17 @@ public class FilteredCommonTree extends Composite { static { ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$ if (descriptor != null) { - JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor); + JFaceResources.getImageRegistry().put(FilteredCommonTree.CLEAR_ICON, descriptor); } descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif"); //$NON-NLS-1$ if (descriptor != null) { - JFaceResources.getImageRegistry().put(DISABLED_CLEAR_ICON, descriptor); + JFaceResources.getImageRegistry().put(FilteredCommonTree.DISABLED_CLEAR_ICON, descriptor); } } /** * Create a new instance of the receiver. - * + * * @param viewerId * An id tied to the extensions that is used to focus specific * content to a particular instance of the Common Navigator @@ -244,7 +247,7 @@ public class FilteredCommonTree extends Composite { * the default creation behavior may use this constructor, but must ensure * that the <code>init(composite, int, PatternFilter)</code> method is * called in the overriding constructor. - * + * * @param viewerId * An id tied to the extensions that is used to focus specific * content to a particular instance of the Common Navigator @@ -253,7 +256,7 @@ public class FilteredCommonTree extends Composite { * @param useNewLook * <code>true</code> if the new 3.5 look should be used * @see #init(int, PatternFilter) - * + * * @since 0.9.0 */ protected FilteredCommonTree(String viewerId, Composite parent, boolean useNewLook) { @@ -264,12 +267,12 @@ public class FilteredCommonTree extends Composite { } private static boolean useNativeSearchField(Composite composite) { - if (useNativeSearchField == null) { - useNativeSearchField = Boolean.FALSE; + if (FilteredCommonTree.useNativeSearchField == null) { + FilteredCommonTree.useNativeSearchField = Boolean.FALSE; Text testText = null; try { testText = new Text(composite, SWT.SEARCH | SWT.ICON_CANCEL); - useNativeSearchField = new Boolean((testText.getStyle() & SWT.ICON_CANCEL) != 0); + FilteredCommonTree.useNativeSearchField = new Boolean((testText.getStyle() & SWT.ICON_CANCEL) != 0); } finally { if (testText != null) { testText.dispose(); @@ -277,15 +280,15 @@ public class FilteredCommonTree extends Composite { } } - return useNativeSearchField.booleanValue(); + return FilteredCommonTree.useNativeSearchField.booleanValue(); } /** * Create the filtered tree. - * + * * @param treeStyle * the style bits for the <code>Tree</code> - * + * * @since 0.9.0 */ protected void init(int treeStyle) { @@ -299,7 +302,7 @@ public class FilteredCommonTree extends Composite { /** * Create the filtered tree's controls. Subclasses should override. - * + * * @param aParent * the parent composite * @param treeStyle @@ -313,7 +316,7 @@ public class FilteredCommonTree extends Composite { setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); if (showFilterControls) { - if (!useNewLook || useNativeSearchField(aParent)) { + if (!useNewLook || FilteredCommonTree.useNativeSearchField(aParent)) { filterComposite = new Composite(this, SWT.NONE); } else { filterComposite = new Composite(this, SWT.BORDER); @@ -345,17 +348,18 @@ public class FilteredCommonTree extends Composite { * Create the filter controls. By default, a text and corresponding tool bar * button that clears the contents of the text is created. Subclasses may * override. - * + * * @param aParent * parent <code>Composite</code> of the filter controls * @return the <code>Composite</code> that contains the filter controls */ protected Composite createFilterControls(Composite aParent) { createFilterText(aParent); - if (useNewLook) + if (useNewLook) { createClearTextNew(aParent); - else + } else { createClearTextOld(aParent); + } if (clearButtonControl != null) { // initially there is no text to clear clearButtonControl.setVisible(false); @@ -373,7 +377,7 @@ public class FilteredCommonTree extends Composite { * {@link #doCreateTreeViewer(Composite, int)} to create the tree viewer. * Subclasses should override {@link #doCreateTreeViewer(Composite, int)} * instead of overriding this method. - * + * * @param aParent * parent <code>Composite</code> * @param style @@ -405,13 +409,13 @@ public class FilteredCommonTree extends Composite { /** * Creates the tree viewer. Subclasses may override. - * + * * @param aParent * the parent composite * @param style * SWT style bits used to create the tree viewer * @return the tree viewer - * + * * @since 0.9.0 */ protected CommonViewer doCreateCommonViewer(Composite aParent, int style) { @@ -420,18 +424,18 @@ public class FilteredCommonTree extends Composite { /** * Return the first item in the tree that matches the filter pattern. - * + * * @param items * @return the first matching TreeItem */ private TreeItem getFirstMatchingItem(TreeItem[] items) { TreeItem result = null; - for (int i = 0; i < items.length; i++) { - if (patternFilter.isLeafMatch(commonTreeViewer, items[i].getData()) && patternFilter.isElementSelectable(items[i].getData())) { - result = items[i]; + for (TreeItem item : items) { + if (patternFilter.isLeafMatch(commonTreeViewer, item.getData()) && patternFilter.isElementSelectable(item.getData())) { + result = item; break; } - TreeItem treeItem = getFirstMatchingItem(items[i].getItems()); + TreeItem treeItem = getFirstMatchingItem(item.getItems()); if (treeItem != null) { result = treeItem; break; @@ -442,7 +446,7 @@ public class FilteredCommonTree extends Composite { /** * Create the refresh job for the receiver. - * + * */ private void createRefreshJob() { refreshJob = doCreateRefreshJob(); @@ -452,14 +456,14 @@ public class FilteredCommonTree extends Composite { /** * Creates a workbench job that will refresh the tree based on the current * filter text. Subclasses may override. - * + * * @return a workbench job that can be scheduled to refresh the tree - * + * * @since 0.9.0 */ // CHECKSTYLE:OFF Original method protected WorkbenchJob doCreateRefreshJob() { - return new WorkbenchJob("Refresh Filter") { //$NON-NLS-1$ + return new WorkbenchJob(Messages.FilteredCommonTree_refreshFilterJob) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { IStatus result = null; @@ -489,8 +493,7 @@ public class FilteredCommonTree extends Composite { if (!narrowingDown) { // collapse all TreeItem[] is = commonTreeViewer.getTree().getItems(); - for (int i = 0; i < is.length; i++) { - TreeItem item = is[i]; + for (TreeItem item : is) { if (item.getExpanded()) { commonTreeViewer.setExpandedState(item.getData(), false); } @@ -509,7 +512,7 @@ public class FilteredCommonTree extends Composite { TreeItem[] items = getViewer().getTree().getItems(); int treeHeight = getViewer().getTree().getBounds().height; int numVisibleItems = treeHeight / getViewer().getTree().getItemHeight(); - long stopTime = SOFT_MAX_EXPAND_TIME + System.currentTimeMillis(); + long stopTime = FilteredCommonTree.SOFT_MAX_EXPAND_TIME + System.currentTimeMillis(); boolean cancel = false; if (items.length > 0 && recursiveExpand(items, monitor, stopTime, new int[] { numVisibleItems })) { cancel = true; @@ -546,7 +549,7 @@ public class FilteredCommonTree extends Composite { /** * Returns true if the job should be canceled (because of timeout or * actual cancellation). - * + * * @param items * @param monitor * @param cancelTime @@ -585,7 +588,7 @@ public class FilteredCommonTree extends Composite { /** * Update the tool bar according to the new visible status. - * + * * @param visible * The new visible status. */ @@ -603,7 +606,7 @@ public class FilteredCommonTree extends Composite { * {@link #doCreateFilterText(Composite)} to create the text control. * Subclasses should override {@link #doCreateFilterText(Composite)} instead * of overriding this method. - * + * * @param aParent * <code>Composite</code> of the filter text */ @@ -623,29 +626,29 @@ public class FilteredCommonTree extends Composite { /** * Return the number of filtered items - * + * * @return int */ private int getFilteredItemsCount() { int total = 0; TreeItem[] items = getViewer().getTree().getItems(); - for (int i = 0; i < items.length; i++) { - total += itemCount(items[i]); + for (TreeItem item : items) { + total += itemCount(item); } return total; } /** * Return the count of treeItem and it's children to infinite depth. - * + * * @param treeItem * @return int */ private int itemCount(TreeItem treeItem) { int count = 1; TreeItem[] children = treeItem.getItems(); - for (int i = 0; i < children.length; i++) { - count += itemCount(children[i]); + for (TreeItem element : children) { + count += itemCount(element); } return count; } @@ -728,10 +731,11 @@ public class FilteredCommonTree extends Composite { if (hasFocus && textChanged && filterText.getText().trim().length() > 0) { Tree tree = getViewer().getTree(); TreeItem item; - if (tree.getSelectionCount() > 0) + if (tree.getSelectionCount() > 0) { item = getFirstMatchingItem(tree.getSelection()); - else + } else { item = getFirstMatchingItem(tree.getItems()); + } if (item != null) { tree.setSelection(new TreeItem[] { item }); ISelection sel = getViewer().getSelection(); @@ -757,8 +761,9 @@ public class FilteredCommonTree extends Composite { filterText.addSelectionListener(new SelectionAdapter() { @Override public void widgetDefaultSelected(SelectionEvent e) { - if (e.detail == SWT.ICON_CANCEL) + if (e.detail == SWT.ICON_CANCEL) { clearText(); + } } }); } @@ -769,8 +774,9 @@ public class FilteredCommonTree extends Composite { gridData.horizontalIndent = 2; // if the text widget supported cancel then it will have it's own // integrated button. We can take all of the space. - if ((filterText.getStyle() & SWT.ICON_CANCEL) != 0) + if ((filterText.getStyle() & SWT.ICON_CANCEL) != 0) { gridData.horizontalSpan = 2; + } filterText.setLayoutData(gridData); } @@ -779,15 +785,15 @@ public class FilteredCommonTree extends Composite { /** * Creates the text control for entering the filter text. Subclasses may * override. - * + * * @param aParent * the parent composite * @return the text widget - * + * * @since 0.9.0 */ protected Text doCreateFilterText(Composite aParent) { - if (!useNewLook || useNativeSearchField(aParent)) { + if (!useNewLook || FilteredCommonTree.useNativeSearchField(aParent)) { return new Text(aParent, SWT.SINGLE | SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL); } return new Text(aParent, SWT.SINGLE); @@ -807,9 +813,9 @@ public class FilteredCommonTree extends Composite { /** * Return the time delay that should be used when scheduling the filter * refresh job. Subclasses may override. - * + * * @return a time delay in milliseconds before the job should run - * + * * @since 0.9.0 */ protected long getRefreshJobDelay() { @@ -818,14 +824,14 @@ public class FilteredCommonTree extends Composite { /** * Set the background for the widgets that support the filter text area. - * + * * @param background * background <code>Color</code> to set */ @Override public void setBackground(Color background) { super.setBackground(background); - if (filterComposite != null && (!useNewLook || useNativeSearchField(filterComposite))) { + if (filterComposite != null && (!useNewLook || FilteredCommonTree.useNativeSearchField(filterComposite))) { filterComposite.setBackground(background); } if (filterToolBar != null && filterToolBar.getControl() != null) { @@ -835,7 +841,7 @@ public class FilteredCommonTree extends Composite { /** * Create the button that clears the text. - * + * * @param aParent * parent <code>Composite</code> of toolbar button */ @@ -858,8 +864,8 @@ public class FilteredCommonTree extends Composite { }; clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip); - clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON)); - clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON)); + clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(FilteredCommonTree.CLEAR_ICON)); + clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(FilteredCommonTree.DISABLED_CLEAR_ICON)); filterToolBar.add(clearTextAction); } @@ -867,7 +873,7 @@ public class FilteredCommonTree extends Composite { /** * Create the button that clears the text. - * + * * @param aParent * parent <code>Composite</code> of toolbar button */ @@ -875,8 +881,8 @@ public class FilteredCommonTree extends Composite { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) { - final Image inactiveImage = JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON).createImage(); - final Image activeImage = JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON).createImage(); + final Image inactiveImage = JFaceResources.getImageRegistry().getDescriptor(FilteredCommonTree.DISABLED_CLEAR_ICON).createImage(); + final Image activeImage = JFaceResources.getImageRegistry().getDescriptor(FilteredCommonTree.CLEAR_ICON).createImage(); final Image pressedImage = new Image(getDisplay(), activeImage, SWT.IMAGE_GRAY); final Label clearButton = new Label(aParent, SWT.NONE); @@ -973,7 +979,7 @@ public class FilteredCommonTree extends Composite { /** * Set the text in the filter control. - * + * * @param string * The new filter text */ @@ -986,7 +992,7 @@ public class FilteredCommonTree extends Composite { /** * Returns the pattern filter used by this tree. - * + * * @return The pattern filter; never <code>null</code>. */ public final PatternFilter getPatternFilter() { @@ -995,7 +1001,7 @@ public class FilteredCommonTree extends Composite { /** * Get the tree viewer of the receiver. - * + * * @return the tree viewer */ public CommonViewer getViewer() { @@ -1005,7 +1011,7 @@ public class FilteredCommonTree extends Composite { /** * Get the filter text for the receiver, if it was created. Otherwise return * <code>null</code>. - * + * * @return the filter Text, or null if it was not created */ public Text getFilterControl() { @@ -1015,7 +1021,7 @@ public class FilteredCommonTree extends Composite { /** * Convenience method to return the text of the filter control. If the text * widget is not created, then null is returned. - * + * * @return String in the text, or null if the text does not exist */ protected String getFilterString() { @@ -1026,7 +1032,7 @@ public class FilteredCommonTree extends Composite { * Set the text that will be shown until the first focus. A default value is * provided, so this method only need be called if overriding the default * initial text is desired. - * + * * @param text * initial text to appear in text field */ @@ -1056,7 +1062,7 @@ public class FilteredCommonTree extends Composite { /** * Select all text in the filter text field. - * + * */ protected void selectAll() { if (filterText != null) { @@ -1066,7 +1072,7 @@ public class FilteredCommonTree extends Composite { /** * Get the initial text for the receiver. - * + * * @return String */ protected String getInitialText() { @@ -1077,14 +1083,14 @@ public class FilteredCommonTree extends Composite { * Return a bold font if the given element matches the given pattern. * Clients can opt to call this method from a Viewer's label provider to get * a bold font for which to highlight the given element in the tree. - * + * * @param element * element for which a match should be determined * @param tree * FilteredTree in which the element resides * @param filter * PatternFilter which determines a match - * + * * @return bold font */ public static Font getBoldFont(Object element, FilteredCommonTree tree, PatternFilter filter) { @@ -1115,9 +1121,9 @@ public class FilteredCommonTree extends Composite { /** * Custom tree viewer subclass that clears the caches in patternFilter on * any change to the tree. See bug 187200. - * + * * @since 0.9.0 - * + * */ class NotifyingCommonViewer extends CommonViewer { @@ -1133,16 +1139,16 @@ public class FilteredCommonTree extends Composite { /** * Initialize the pattern filter before calling the super.init() to * avoid NPE when accessing patterf filter. {@inheritDoc} - * + * * @see org.eclipse.ui.navigator.CommonViewer#init() */ @Override protected void init() { // Search the pattern filter ViewerFilter[] visibleFilters = this.getNavigatorContentService().getFilterService().getVisibleFilters(false); - for (int i = 0; i < visibleFilters.length; i++) { - if (visibleFilters[i] instanceof PatternFilter) { - patternFilter = (PatternFilter) visibleFilters[i]; + for (ViewerFilter visibleFilter : visibleFilters) { + if (visibleFilter instanceof PatternFilter) { + patternFilter = (PatternFilter) visibleFilter; // Force activation if (!this.getNavigatorContentService().getFilterService().isActive(PatternFilter.ID)) { if (this.getNavigatorContentService().getFilterService() instanceof NavigatorFilterService) { @@ -1153,8 +1159,11 @@ public class FilteredCommonTree extends Composite { } } if (patternFilter == null) { - SiriusEditPlugin.getPlugin().getLog().log( - new Status(IStatus.ERROR, SiriusEditPlugin.ID, "Required filter " + PatternFilter.ID + " is not present. Filter support of Model Explorer view will not function correctly.")); //$NON-NLS-2$ + SiriusEditPlugin + .getPlugin() + .getLog() + .log(new Status(IStatus.ERROR, SiriusEditPlugin.ID, MessageFormat.format( + Messages.FilteredCommonTree_missingFilter, PatternFilter.ID))); } super.init(); setLabelProvider(new TooltipAwareNavigatorDecoratingLabelProvider(getNavigatorContentService().createCommonLabelProvider())); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/interpreterview/DesignerInterpreterView.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/interpreterview/DesignerInterpreterView.java index c10a4bd281..8f56653109 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/interpreterview/DesignerInterpreterView.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/interpreterview/DesignerInterpreterView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -11,6 +11,7 @@ package org.eclipse.sirius.ui.tools.internal.views.interpreterview; import java.text.DecimalFormat; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -59,6 +60,7 @@ import org.eclipse.sirius.ui.tools.api.views.interpreterview.InterpreterView; import org.eclipse.sirius.ui.tools.internal.views.common.navigator.adapters.ModelDragTargetAdapter; import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; @@ -89,7 +91,7 @@ import org.eclipse.ui.part.ViewPart; /** * An Eclipse view to launch model requests language requests and see the * results. - * + * * @author cbrun */ public class DesignerInterpreterView extends ViewPart implements InterpreterView { @@ -142,12 +144,14 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView private ContentInstanceProposalProvider contentInstanceProposalProvider; private final IVariableStatusListener variableListener = new IVariableStatusListener() { + @Override public void notifyChanged(final Map<?, ?> variables) { refreshVariables(variables); } }; private final ISelectionListener listener = new ISelectionListener() { + @Override public void selectionChanged(final IWorkbenchPart part, final ISelection selection) { if (selection instanceof IStructuredSelection) { final Iterator<?> it = ((IStructuredSelection) selection).iterator(); @@ -184,11 +188,6 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView return contentProvider; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ @Override public void createPartControl(final Composite parent) { getSite().getPage().addSelectionListener(listener); @@ -217,10 +216,6 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView interpreter.addVariableStatusListener(this.variableListener); } - /** - * - * {@inheritDoc} - */ @Override public void setFocus() { if (this.top != null) { @@ -228,11 +223,6 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView } } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.part.WorkbenchPart#dispose() - */ @Override public void dispose() { getSite().getPage().removeSelectionListener(listener); @@ -258,15 +248,11 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView * Creates the action of the view. */ private void createActions() { - this.addDependencyAction = new Action("Add Dependency") { - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.action.Action#run() - */ + this.addDependencyAction = new Action(Messages.DesignerInterpreterView_addDependencyButton) { @Override public void run() { - final InputDialog inputDependency = new InputDialog(getSite().getShell(), "Add Dependency", "Enter the new dependency to add", "", null); + final InputDialog inputDependency = new InputDialog(getSite().getShell(), Messages.DesignerInterpreterView_addDependencyDialogTitle, + Messages.DesignerInterpreterView_addDependencyDialogMessage, "", null); //$NON-NLS-1$ inputDependency.setBlockOnOpen(true); final int result = inputDependency.open(); if (result == Window.OK) { @@ -288,13 +274,13 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView } }; - this.copyToClipboardAction = new Action("Copy to Clipboard") { + this.copyToClipboardAction = new Action(Messages.DesignerInterpreterView_copyToClipboardButton) { @Override public void run() { StringBuilder sb = new StringBuilder(); - sb.append("Result of: ").append(acceleoExpression.getText()).append(" (").append(valuesTree.getItemCount()).append(" elements)\n\n"); + sb.append(MessageFormat.format(Messages.DesignerInterpreterView_copyToClipboardResult, acceleoExpression.getText(), valuesTree.getItemCount())).append("\n\n"); //$NON-NLS-1$ for (TreeItem item : valuesTree.getItems()) { - sb.append("- ").append(item.getText()).append("\n"); + sb.append("- ").append(item.getText()).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ } Clipboard cb = new Clipboard(getSite().getShell().getDisplay()); TextTransfer textTransfer = TextTransfer.getInstance(); @@ -313,7 +299,7 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView /** * This method initializes formToolkit - * + * * @return org.eclipse.ui.forms.widgets.FormToolkit */ private FormToolkit getFormToolkit() { @@ -325,7 +311,7 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView /** * This method initializes intepreterSection - * + * */ private void createIntepreterSection() { final GridData gridData1 = new GridData(); @@ -341,7 +327,7 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView /** * This method initializes variablesSection - * + * */ private void createVariablesSection() { final GridData gridData = new GridData(); @@ -352,7 +338,7 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView gridData.horizontalAlignment = GridData.FILL; variablesSection = getFormToolkit().createSection(top, 0); variablesSection.setExpanded(true); - variablesSection.setText("Variables"); + variablesSection.setText(Messages.DesignerInterpreterView_variablesSection); createVariablesForm(); variablesSection.setLayoutData(gridData); variablesSection.setClient(variablesForm); @@ -373,10 +359,11 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView gridData2.horizontalAlignment = GridData.FILL; interpreterForm = getFormToolkit().createForm(intepreterSection); getFormToolkit().decorateFormHeading(interpreterForm); - interpreterForm.setText("Requests interpreter"); + interpreterForm.setText(Messages.DesignerInterpreterView_requestsInterpreter); acceleoExpression = getFormToolkit().createText(interpreterForm.getBody(), null, SWT.SINGLE | SWT.BORDER); acceleoExpression.setLayoutData(gridData2); acceleoExpression.addModifyListener(new ModifyListener() { + @Override public void modifyText(final ModifyEvent e) { handleNewExpression(); } @@ -389,6 +376,7 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView valuesViewer.setContentProvider(getContentProvider()); valuesViewer.setLabelProvider(labelProvider); valuesViewer.addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(final DoubleClickEvent event) { if (event.getSelection() instanceof IStructuredSelection) { addVariable(((IStructuredSelection) event.getSelection()).toList()); @@ -397,18 +385,20 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView }); /* Configure viewer drag behavior */ - final Transfer[] transfers = new Transfer[] { TRANSFER }; + final Transfer[] transfers = new Transfer[] { DesignerInterpreterView.TRANSFER }; final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; valuesViewer.addDragSupport(dndOperations, transfers, new ModelDragTargetAdapter(valuesViewer)); } private void addVariable(final List<?> list) { if (list.size() > 0 && interpreter != null) { - final InputDialog askSiriusName = new InputDialog(Display.getDefault().getActiveShell(), "Variable name", "Type variable name", IInterpreterSiriusVariables.ELEMENT, new IInputValidator() { - public String isValid(final String newText) { - return null; - } - }); + final InputDialog askSiriusName = new InputDialog(Display.getDefault().getActiveShell(), Messages.DesignerInterpreterView_variableName, Messages.DesignerInterpreterView_typeVariableName, + IInterpreterSiriusVariables.ELEMENT, new IInputValidator() { + @Override + public String isValid(final String newText) { + return null; + } + }); if (askSiriusName.open() == Window.OK) { if (list.size() == 1) { if (askSiriusName.getValue().startsWith(variableTag)) { @@ -450,10 +440,10 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView final long ellapseTime = new Date().getTime() - now; final int numberOfResults = handleExpressionResult(result); final DecimalFormat decimalFormat = new DecimalFormat("###,###,###.###"); //$NON-NLS-1$ - this.interpreterForm.setMessage("Evaluation successful. Number of returned elements : " + numberOfResults + ". Time to evaluate : " + decimalFormat.format(ellapseTime / (double) 1000) - + " second(s)", IMessageProvider.INFORMATION); + this.interpreterForm.setMessage(MessageFormat.format(Messages.DesignerInterpreterView_evaluationResult, numberOfResults, decimalFormat.format(ellapseTime / (double) 1000)), + IMessageProvider.INFORMATION); } catch (final EvaluationException e) { - this.interpreterForm.setMessage("Invalid expression. " + e.getMessage(), IMessageProvider.ERROR); + this.interpreterForm.setMessage(MessageFormat.format(Messages.DesignerInterpreterView_invalidExpressionError, e.getMessage()), IMessageProvider.ERROR); } } } @@ -497,7 +487,7 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView /** * This method initializes variablesForm - * + * */ private void createVariablesForm() { final GridData gridData6 = new GridData(); @@ -519,20 +509,23 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView variablesForm = getFormToolkit().createForm(variablesSection); variablesForm.getBody().setLayout(gridLayout1); - variablesForm.setText("Variables"); + variablesForm.setText(Messages.DesignerInterpreterView_variablesSection); getFormToolkit().decorateFormHeading(variablesForm); - setVariableButton = getFormToolkit().createButton(variablesForm.getBody(), "Set", SWT.PUSH); + setVariableButton = getFormToolkit().createButton(variablesForm.getBody(), Messages.DesignerInterpreterView_setButton, SWT.PUSH); setVariableButton.setLayoutData(gridData4); setVariableButton.addMouseListener(new MouseListener() { + @Override public void mouseDoubleClick(final MouseEvent arg0) { // Nothing happen } + @Override public void mouseDown(final MouseEvent arg0) { // Nothing happen } + @Override public void mouseUp(final MouseEvent arg0) { // Behaviour of the Set button is to save as a variable the // selection in the valuesViewer @@ -543,17 +536,20 @@ public class DesignerInterpreterView extends ViewPart implements InterpreterView } } }); - unSetVariableButton = getFormToolkit().createButton(variablesForm.getBody(), "Unset", SWT.PUSH); + unSetVariableButton = getFormToolkit().createButton(variablesForm.getBody(), Messages.DesignerInterpreterView_unsetButton, SWT.PUSH); unSetVariableButton.setLayoutData(gridData5); unSetVariableButton.addMouseListener(new MouseListener() { + @Override public void mouseDoubleClick(final MouseEvent arg0) { // Nothing happens } + @Override public void mouseDown(final MouseEvent arg0) { // Nothing happens } + @Override public void mouseUp(final MouseEvent arg0) { // Behaviour of the unSet button is to remove the variable // selected in the variablesViewer diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/extension/tab/CommonNavigatorTab.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/extension/tab/CommonNavigatorTab.java index 380d634cd1..fc00b834b6 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/extension/tab/CommonNavigatorTab.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/views/modelexplorer/extension/tab/CommonNavigatorTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -10,13 +10,12 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.views.modelexplorer.extension.tab; -import java.util.Collection; - import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.IModelExplorerTabExtension; import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.DeleteActionHandler; import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.ModelExplorerView; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CTabFolder; @@ -32,7 +31,7 @@ import com.google.common.collect.Sets; /** * TODO MCH comment here. - * + * * @author mchauvin */ public class CommonNavigatorTab implements IModelExplorerTabExtension { @@ -40,7 +39,7 @@ public class CommonNavigatorTab implements IModelExplorerTabExtension { /** the id of the tab. */ public static final String TAB_ID = "navigator"; //$NON-NLS-1$ - private static final String MODEL_EXPLORER_STRUCTURE_TAB_NAME = "Navigator"; + private static final String MODEL_EXPLORER_STRUCTURE_TAB_NAME = Messages.CommonNavigatorTab_name; private static final String MODEL_EXPLORER_STRUCTURE_TAB_ICON = "icons/full/others/structure.gif"; //$NON-NLS-1$ @@ -51,7 +50,7 @@ public class CommonNavigatorTab implements IModelExplorerTabExtension { /** * Create a new instance, this is the single extension for which we will * have a constructor with a parameter. - * + * * @param view * the main view */ @@ -59,16 +58,12 @@ public class CommonNavigatorTab implements IModelExplorerTabExtension { this.view = view; } - /** - * {@inheritDoc} - */ + @Override public void init(IViewSite site) { /* do nothing */ } - /** - * {@inheritDoc} - */ + @Override public Control createTabControl(CTabFolder tabFolder) { view.createNavigatorControl(tabFolder); hookGlobalActions(); @@ -88,6 +83,7 @@ public class CommonNavigatorTab implements IModelExplorerTabExtension { bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteActionHandler); view.getCommonViewer().getControl().addKeyListener(new KeyAdapter() { + @Override public void keyPressed(KeyEvent event) { if (event.character == SWT.DEL && event.stateMask == 0 && deleteActionHandler.isEnabled()) { deleteActionHandler.run(); @@ -98,48 +94,26 @@ public class CommonNavigatorTab implements IModelExplorerTabExtension { bars.updateActionBars(); } - /** - * {@inheritDoc} - */ + @Override public String getToolTipText() { - return MODEL_EXPLORER_STRUCTURE_TAB_NAME; + return CommonNavigatorTab.MODEL_EXPLORER_STRUCTURE_TAB_NAME; } - /** - * {@inheritDoc} - */ + @Override public Iterable<IAction> getActions() { - Collection<IAction> actions = Sets.newLinkedHashSet(); - - // IAction testAction = new Action("Enable project mode", - // IAction.AS_CHECK_BOX) { - // public void run() { - // if - // (CommonNavigatorTab.MODE_MANAGER.getMode().equals(NavigatorMode.RESOURCE)) - // CommonNavigatorTab.MODE_MANAGER.setMode(NavigatorMode.PROJECT); - // else - // CommonNavigatorTab.MODE_MANAGER.setMode(NavigatorMode.RESOURCE); - // view.refreshNavigatorInput(); - // } - // }; - // testAction.setImageDescriptor(SiriusEditPlugin.Implementation.getBundledImageDescriptor(PROJECT_MODE_ACTIVATION)); - // actions.add(testAction); - - return actions; + return Sets.<IAction>newLinkedHashSet(); } /** * Get the associated image. - * + * * @return the tab image */ public Image getImage() { - return SiriusEditPlugin.getPlugin().getBundledImage(MODEL_EXPLORER_STRUCTURE_TAB_ICON); + return SiriusEditPlugin.getPlugin().getBundledImage(CommonNavigatorTab.MODEL_EXPLORER_STRUCTURE_TAB_ICON); } - /** - * {@inheritDoc} - */ + @Override public void dispose() { view = null; } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateOrAddResourceWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateOrAddResourceWizard.java index e12928a4a7..a348594abb 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateOrAddResourceWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateOrAddResourceWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -46,6 +46,7 @@ import org.eclipse.sirius.ui.tools.internal.wizards.pages.GenericInitialObjectPa import org.eclipse.sirius.ui.tools.internal.wizards.pages.GenericModelCreationPage; import org.eclipse.sirius.ui.tools.internal.wizards.pages.SelectMetamodelWizardPage; import org.eclipse.sirius.viewpoint.SiriusPlugin; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; @@ -59,8 +60,6 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; */ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDependencyWizard { - private static final String WIZARD_TITLE = "Add semantic resource"; - /** * The selection. */ @@ -117,6 +116,7 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend * @param availableSessions * the available sessions */ + @Override public void setSessions(final List<Session> availableSessions) { this.sessions = availableSessions; } @@ -133,24 +133,14 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend return selection; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, - * org.eclipse.jface.viewers.IStructuredSelection) - */ + @Override public void init(final IWorkbench w, final IStructuredSelection s) { this.workbench = w; this.selection = s; - setWindowTitle(WIZARD_TITLE); + setWindowTitle(Messages.CreateOrAddResourceWizard_windowTitle); setNeedsProgressMonitor(true); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#canFinish() - */ @Override public boolean canFinish() { if (!selectionPage.createResource()) { @@ -160,11 +150,6 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend } } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage) - */ @Override public IWizardPage getNextPage(final IWizardPage page) { if (page == selectionPage) { @@ -182,35 +167,24 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend return super.getNextPage(page); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ @Override public void addPages() { selectionPage = new CreateOrAddResourceWizardPage("selectionPage"); //$NON-NLS-1$ - selectionPage.setTitle(WIZARD_TITLE); + selectionPage.setTitle(Messages.CreateOrAddResourceWizard_windowTitle); addPage(selectionPage); - metamodelPage = new SelectMetamodelWizardPage("metamodelPage", new String[] { "ecore" }, false); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ - metamodelPage.setTitle(WIZARD_TITLE); + metamodelPage = new SelectMetamodelWizardPage("metamodelPage", new String[] { "ecore" }, false); //$NON-NLS-1$ //$NON-NLS-2$ + metamodelPage.setTitle(Messages.CreateOrAddResourceWizard_windowTitle); addPage(metamodelPage); initialObjectPage = new GenericInitialObjectPage("initialObjectPage"); //$NON-NLS-1$ - initialObjectPage.setTitle(WIZARD_TITLE); - initialObjectPage.setDescription("Select the root instance type and the file encoding"); + initialObjectPage.setTitle(Messages.CreateOrAddResourceWizard_windowTitle); + initialObjectPage.setDescription(Messages.CreateOrAddResourceWizard_initialEObject); addPage(initialObjectPage); modelCreationPage = new GenericModelCreationPage("modelCreationPage", new StructuredSelection()); //$NON-NLS-1$ - modelCreationPage.setTitle(WIZARD_TITLE); - modelCreationPage.setDescription("Enter the file name and choose the parent container"); + modelCreationPage.setTitle(Messages.CreateOrAddResourceWizard_windowTitle); + modelCreationPage.setDescription(Messages.CreateOrAddResourceWizard_modelCreation); addPage(modelCreationPage); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#createPageControls(org.eclipse.swt.widgets.Composite) - */ @Override public void createPageControls(final Composite pageContainer) { selectionPage.createControl(pageContainer); @@ -224,11 +198,6 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend } } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ @Override public boolean performFinish() { boolean finished = true; @@ -265,13 +234,15 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend resource.getContents().add(rootObject); } - /* Save the contents of the resource to the file system. */ + /* + * Save the contents of the resource to the file system. + */ final Map<Object, Object> options = new HashMap<Object, Object>(); options.put(XMLResource.OPTION_ENCODING, initialObjectPage.getEncoding()); resource.save(options); uris.add(resource.getURI()); } catch (final IOException e) { - SiriusPlugin.getDefault().error("the new resource was not created on disk", e); + SiriusPlugin.getDefault().error(Messages.CreateOrAddResourceWizard_resourceNotCreatedError, e); } finally { monitor.done(); } @@ -281,12 +252,12 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend try { getContainer().run(true, false, operation); } catch (final InvocationTargetException e) { - SiriusPlugin.getDefault().error("Error creating resource", e); + SiriusPlugin.getDefault().error(Messages.CreateOrAddResourceWizard_resourceCreationError, e); } catch (final InterruptedException e) { - SiriusPlugin.getDefault().error("Error creating resource", e); + SiriusPlugin.getDefault().error(Messages.CreateOrAddResourceWizard_resourceCreationError, e); } } else { - final ResourceDialog resourceDialog = new SemanticResourceDialog(Display.getCurrent().getActiveShell(), "Select resources to add", SWT.OPEN | SWT.MULTI); + final ResourceDialog resourceDialog = new SemanticResourceDialog(Display.getCurrent().getActiveShell(), Messages.CreateOrAddResourceWizard_selectResourceMessage, SWT.OPEN | SWT.MULTI); final int result = resourceDialog.open(); if (result == Window.OK) { uris.addAll(resourceDialog.getURIs()); @@ -304,33 +275,23 @@ public class CreateOrAddResourceWizard extends Wizard implements IAddModelDepend } } } catch (final InterruptedException e) { - SiriusPlugin.getDefault().error("Error adding resource", e); + SiriusPlugin.getDefault().error(Messages.CreateOrAddResourceWizard_resourceAdditionError, e); finished = false; } catch (final InvocationTargetException e) { - SiriusPlugin.getDefault().error("Error adding ressource", e.getTargetException()); + SiriusPlugin.getDefault().error(Messages.CreateOrAddResourceWizard_resourceAdditionError, e.getTargetException()); finished = false; } } return finished; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.actions.analysis.IAddModelDependencyWizard#canApply(java.util.Collection) - */ + @Override public boolean canApply(Collection<Session> availableSessions) { return true; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.ui.tools.api.actions.analysis.IAddModelDependencyWizard#getWizardTitle() - */ + @Override public String getWizardTitle() { - return "Add Model Wizard"; + return Messages.CreateOrAddResourceWizard_wizardTitle; } } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateRepresentationWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateRepresentationWizard.java index ae25535b9c..f4e44e2c55 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateRepresentationWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateRepresentationWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -18,13 +18,14 @@ import org.eclipse.sirius.ui.tools.internal.actions.creation.CreateRepresentatio import org.eclipse.sirius.ui.tools.internal.views.common.SessionLabelProvider; import org.eclipse.sirius.ui.tools.internal.wizards.pages.RepresentationSelectionWizardPage; import org.eclipse.sirius.ui.tools.internal.wizards.pages.SemanticElementSelectionWizardPage; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * This wizard creates a representation, choosing the representation type and * the semantic element. - * + * * @author nlepine - * + * */ public class CreateRepresentationWizard extends Wizard { @@ -36,7 +37,7 @@ public class CreateRepresentationWizard extends Wizard { /** * Constructor. - * + * * @param session * origin session. */ @@ -48,15 +49,11 @@ public class CreateRepresentationWizard extends Wizard { * Initialize the wizard. */ public void init() { - setWindowTitle("Create Representation"); + setWindowTitle(Messages.CreateRepresentationWizard_title); setNeedsProgressMonitor(false); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ + @Override public boolean performFinish() { EObject element = selectElementPage.getSelectedElement(); if (element != null) { @@ -67,11 +64,7 @@ public class CreateRepresentationWizard extends Wizard { return true; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ + @Override public void addPages() { representationWizardPage = new RepresentationSelectionWizardPage(session); selectElementPage = new SemanticElementSelectionWizardPage(session); @@ -80,21 +73,14 @@ public class CreateRepresentationWizard extends Wizard { addPage(selectElementPage); } - /** - * - * {@inheritDoc} - */ + @Override public void dispose() { super.dispose(); selectElementPage.dispose(); representationWizardPage.dispose(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#canFinish() - */ + @Override public boolean canFinish() { return !representationWizardPage.isCurrentPageOnWizard() && super.canFinish(); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateSessionResourceWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateSessionResourceWizard.java index 6836b59862..47834a2fbb 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateSessionResourceWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/CreateSessionResourceWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008, 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES 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 @@ -28,13 +28,14 @@ import org.eclipse.sirius.business.api.session.SessionCreationOperation; import org.eclipse.sirius.common.ui.SiriusTransPlugin; import org.eclipse.sirius.common.ui.tools.api.selection.page.EObjectSelectionWizardPage; import org.eclipse.sirius.ui.tools.internal.wizards.pages.SessionResourceCreationWizardPage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.actions.WorkspaceModifyOperation; /** * Wizard to create a new DView from an Existing model. - * + * * @author ymortier */ public class CreateSessionResourceWizard extends Wizard implements INewWizard { @@ -66,7 +67,7 @@ public class CreateSessionResourceWizard extends Wizard implements INewWizard { /** * Constructor. - * + * * @param initialSelection * The initial selection */ @@ -80,7 +81,7 @@ public class CreateSessionResourceWizard extends Wizard implements INewWizard { /** * return the current selection. - * + * * @return the current selection. */ public IStructuredSelection getSelection() { @@ -90,25 +91,14 @@ public class CreateSessionResourceWizard extends Wizard implements INewWizard { return selection; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, - * org.eclipse.jface.viewers.IStructuredSelection) - */ + @Override public void init(final IWorkbench w, final IStructuredSelection s) { this.workbench = w; this.selection = s; - setWindowTitle("Create .aird file"); + setWindowTitle(Messages.CreateSessionResourceWizard_title); setNeedsProgressMonitor(true); } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ @Override public void addPages() { final Collection<String> extensions = new ArrayList<String>(); @@ -117,11 +107,6 @@ public class CreateSessionResourceWizard extends Wizard implements INewWizard { addPage(diagramModelFilePage); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ @Override public boolean performFinish() { final IRunnableWithProgress op = new DiagramFileCreationOperation(); @@ -133,9 +118,9 @@ public class CreateSessionResourceWizard extends Wizard implements INewWizard { // return false; } catch (final InvocationTargetException e) { if (e.getTargetException() instanceof CoreException) { - ErrorDialog.openError(getContainer().getShell(), "Error creating resource", null, ((CoreException) e.getTargetException()).getStatus()); + ErrorDialog.openError(getContainer().getShell(), Messages.CreateSessionResourceWizard_resourceCreationError, null, ((CoreException) e.getTargetException()).getStatus()); } else { - SiriusTransPlugin.getPlugin().error("Error creating aird session data", e.getTargetException()); //$NON-NLS-1$ + SiriusTransPlugin.getPlugin().error(Messages.CreateSessionResourceWizard_sessionDataCreationError, e.getTargetException()); } // return false; errorCatch = true; @@ -149,7 +134,7 @@ public class CreateSessionResourceWizard extends Wizard implements INewWizard { /** * return the newly created {@link Session}. - * + * * @return the newly created {@link Session}. */ public Session getCreatedSession() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ExtractRepresentationsWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ExtractRepresentationsWizard.java index 8430b05716..1ec4ee9165 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ExtractRepresentationsWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ExtractRepresentationsWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -36,6 +36,7 @@ import org.eclipse.sirius.viewpoint.DAnalysis; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.SiriusPlugin; import org.eclipse.sirius.viewpoint.ViewpointFactory; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.actions.WorkspaceModifyOperation; @@ -43,9 +44,9 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; /** * This wizard ask the user for which viewpoints he wants to externalize and * create the new .aird files. - * + * * @author cbrun - * + * */ public class ExtractRepresentationsWizard extends Wizard { @@ -61,7 +62,7 @@ public class ExtractRepresentationsWizard extends Wizard { /** * Constructor. - * + * * @param session * origin session. * @param domain @@ -77,22 +78,17 @@ public class ExtractRepresentationsWizard extends Wizard { /** * Initialize the wizard. - * + * * @param workbench * the workbench * @param selection * the selection */ public void init(final IWorkbench workbench, final IStructuredSelection selection) { - setWindowTitle("Extract views"); + setWindowTitle(Messages.ExtractRepresentationsWizard_title); setNeedsProgressMonitor(true); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ @Override public boolean performFinish() { @@ -112,11 +108,9 @@ public class ExtractRepresentationsWizard extends Wizard { return true; } - /** - * @param slaveAnalysis - */ private void moveRepresentations(final DAnalysis slaveAnalysis) { final IRunnableWithProgress moveReps = new IRunnableWithProgress() { + @Override public void run(final IProgressMonitor mon) { domain.getCommandStack().execute(new MoveRepresentationCommand(session, slaveAnalysis, representations)); } @@ -124,39 +118,29 @@ public class ExtractRepresentationsWizard extends Wizard { try { getContainer().run(false, true, moveReps); } catch (final InterruptedException e) { - SiriusPlugin.getDefault().warning("the move representations action was interrupted", e); + SiriusPlugin.getDefault().warning(Messages.ExtractRepresentationsWizard_moveInterrupted, e); } catch (final InvocationTargetException e) { - SiriusPlugin.getDefault().error("the move representations encountered an exception", e); + SiriusPlugin.getDefault().error(Messages.ExtractRepresentationsWizard_moveFailed, e); } } - /** - * @param op - * @param errorCatch - * @return - */ private boolean createAIRDFile(final IRunnableWithProgress op, final boolean error) { boolean errorCatch = error; try { getContainer().run(false, true, op); } catch (final InterruptedException e) { errorCatch = true; - // return false; } catch (final InvocationTargetException e) { if (e.getTargetException() instanceof CoreException) { - ErrorDialog.openError(getContainer().getShell(), "Error creating resource", null, ((CoreException) e.getTargetException()).getStatus()); + ErrorDialog.openError(getContainer().getShell(), Messages.ExtractRepresentationsWizard_resourceCreationError, null, ((CoreException) e.getTargetException()).getStatus()); } else { - SiriusTransPlugin.getPlugin().error("Error creating aird session data", e.getTargetException()); //$NON-NLS-1$ + SiriusTransPlugin.getPlugin().error(Messages.ExtractRepresentationsWizard_airdCreationError, e.getTargetException()); } - // return false; errorCatch = true; } return errorCatch; } - /** - * @return - */ private DAnalysis prepareNewAnalysis() { final DAnalysis slaveAnalysis = ViewpointFactory.eINSTANCE.createDAnalysis(); domain.getCommandStack().execute(new PrepareNewAnalysisCommand(domain, pickedResource, slaveAnalysis, session)); @@ -172,10 +156,6 @@ public class ExtractRepresentationsWizard extends Wizard { } } - /** - * @param uiSession - * @param representation - */ private void closeOpenedEditor(final IEditingSession uiSession, final DRepresentation representation) { final IEditorPart editor = uiSession.getEditor(representation); if (editor != null) { @@ -183,22 +163,17 @@ public class ExtractRepresentationsWizard extends Wizard { } } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ @Override public void addPages() { final Collection<String> extensions = new ArrayList<String>(); extensions.add(SiriusUtil.DESCRIPTION_MODEL_EXTENSION); - sessionResourceFilePage = new SessionResourceCreationWizardPage("Representations file", new StructuredSelection(), SiriusUtil.SESSION_RESOURCE_EXTENSION); //$NON-NLS-1$ + sessionResourceFilePage = new SessionResourceCreationWizardPage(Messages.ExtractRepresentationsWizard_pageName, new StructuredSelection(), SiriusUtil.SESSION_RESOURCE_EXTENSION); addPage(sessionResourceFilePage); } /** * return the newly created resource. - * + * * @return the newly created resource. */ public Resource getCreatedResource() { @@ -213,7 +188,6 @@ public class ExtractRepresentationsWizard extends Wizard { @Override protected void execute(final IProgressMonitor monitor) throws CoreException, InterruptedException { - final ResourceSet set = session.getTransactionalEditingDomain().getResourceSet(); pickedResource = set.createResource(sessionResourceFilePage.getURI()); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ModelingProjectWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ModelingProjectWizard.java index 82594f0563..9f0577dcca 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ModelingProjectWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/ModelingProjectWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.sirius.ui.tools.api.project.ModelingProjectManager; import org.eclipse.sirius.ui.tools.internal.wizards.pages.NewModelingProjectCreationWizardPage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.INewWizard; @@ -32,7 +33,7 @@ import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; * This Class is the wizard that creates a viewpoint modeling project. This will * creates a project with the viewpoint modeling nature and add a aird file * automatically named. - * + * * @author mchauvin */ public class ModelingProjectWizard extends Wizard implements INewWizard { @@ -57,7 +58,7 @@ public class ModelingProjectWizard extends Wizard implements INewWizard { /** * Creates the project, all the directories and files and open the .odesign. - * + * * @return true if successful */ @Override @@ -68,6 +69,7 @@ public class ModelingProjectWizard extends Wizard implements INewWizard { final IPath locationPath = newProjectPage.getLocationPath(); getContainer().run(true, false, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { ModelingProjectManager.INSTANCE.createNewModelingProject(projectName, locationPath, true, monitor); @@ -89,39 +91,24 @@ public class ModelingProjectWizard extends Wizard implements INewWizard { } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, - * org.eclipse.jface.viewers.IStructuredSelection) - */ + @Override public void init(final IWorkbench wkbch, final IStructuredSelection sel) { - setWindowTitle("New Modeling Project"); + setWindowTitle(Messages.ModelingProjectWizard_title); setDefaultPageImageDescriptor(SiriusEditPlugin.Implementation.getBundledImageDescriptor("icons/wizban/banner_modeling_project.gif")); //$NON-NLS-1$ } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#createPageControls(org.eclipse.swt.widgets.Composite) - */ @Override public void createPageControls(final Composite pageContainer) { super.createPageControls(pageContainer); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ @Override public void addPages() { - newProjectPage = new NewModelingProjectCreationWizardPage(SiriusEditPlugin.getPlugin().getString("_UI_ModelingProjectWizard_label")); //$NON-NLS-1$ + newProjectPage = new NewModelingProjectCreationWizardPage(SiriusEditPlugin.INSTANCE.getString("_UI_ModelingProjectWizard_label")); //$NON-NLS-1$ newProjectPage.setInitialProjectName(""); //$NON-NLS-1$ - newProjectPage.setTitle(SiriusEditPlugin.getPlugin().getString("_UI_ModelingProjectWizard_label")); //$NON-NLS-1$ - newProjectPage.setDescription(SiriusEditPlugin.getPlugin().getString("_UI_ModelingProjectWizard_description")); //$NON-NLS-1$ + newProjectPage.setTitle(SiriusEditPlugin.INSTANCE.getString("_UI_ModelingProjectWizard_label")); //$NON-NLS-1$ + newProjectPage.setDescription(SiriusEditPlugin.INSTANCE.getString("_UI_ModelingProjectWizard_description")); //$NON-NLS-1$ addPage(newProjectPage); super.addPages(); } diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/NewSessionWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/NewSessionWizard.java index 8aec3265db..0c68350354 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/NewSessionWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/NewSessionWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -43,6 +43,7 @@ import org.eclipse.sirius.ui.business.api.session.SessionHelper; import org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelection; import org.eclipse.sirius.ui.tools.internal.wizards.pages.SessionFileCreationWizardPage; import org.eclipse.sirius.ui.tools.internal.wizards.pages.SessionKindSelectionWizardPage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; @@ -51,9 +52,9 @@ import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; /** * Wizard to create a new Session. - * + * * Can be used in project without the modeling nature only. - * + * * @author mchauvin */ public class NewSessionWizard extends Wizard implements INewWizard { @@ -63,8 +64,6 @@ public class NewSessionWizard extends Wizard implements INewWizard { */ public static final String ID = "org.eclipse.sirius.ui.session.creation"; //$NON-NLS-1$ - private static final String SESSION_CREATION_ERROR_MSG = "Error creating Representations File"; - /** * The selection. */ @@ -99,7 +98,7 @@ public class NewSessionWizard extends Wizard implements INewWizard { /** * Constructor. - * + * * @param initialSelection * The initial selection */ @@ -109,7 +108,7 @@ public class NewSessionWizard extends Wizard implements INewWizard { /** * return the current selection. - * + * * @return the current selection. */ public IStructuredSelection getSelection() { @@ -119,25 +118,15 @@ public class NewSessionWizard extends Wizard implements INewWizard { return selection; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, - * org.eclipse.jface.viewers.IStructuredSelection) - */ + @Override public void init(final IWorkbench w, final IStructuredSelection s) { this.selection = s; this.workbench = w; - setWindowTitle("New Representations File"); + setWindowTitle(Messages.NewSessionWizard_title); setNeedsProgressMonitor(true); setDefaultPageImageDescriptor(SiriusEditPlugin.Implementation.getBundledImageDescriptor("icons/wizban/banner_aird.gif")); //$NON-NLS-1$ } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#canFinish() - */ @Override public boolean canFinish() { if (sessionKindWizardPage.emptySession()) { @@ -147,19 +136,13 @@ public class NewSessionWizard extends Wizard implements INewWizard { } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ @Override public void addPages() { final boolean singleSemanticResourceSelected = selection.size() == 1 && selection.getFirstElement() instanceof IFile; final boolean defaultToEmptyModel = !singleSemanticResourceSelected; - sessionKindWizardPage = new SessionKindSelectionWizardPage("SessionKind", defaultToEmptyModel); + sessionKindWizardPage = new SessionKindSelectionWizardPage("SessionKind", defaultToEmptyModel); //$NON-NLS-1$ addPage(sessionKindWizardPage); - modelSelectionPage = new SelectFilesWizardPage("Select model to analyse", 1, 1, new String[] { StringUtil.JOKER_STRING }); + modelSelectionPage = new SelectFilesWizardPage(Messages.NewSessionWizard_selectModel, 1, 1, new String[] { StringUtil.JOKER_STRING }); if (selection != null) { modelSelectionPage.setInitialSelection(selection); } @@ -168,11 +151,6 @@ public class NewSessionWizard extends Wizard implements INewWizard { addPage(sessionFileCreationPage); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ @Override public boolean performFinish() { boolean finished = true; @@ -184,6 +162,7 @@ public class NewSessionWizard extends Wizard implements INewWizard { final Session session = sessionCreationOperation.getSession(); getContainer().run(false, false, new IRunnableWithProgress() { + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (session != null && !semanticResourceURIs.isEmpty()) { ViewpointSelection.openViewpointsSelectionDialog(session); @@ -201,11 +180,11 @@ public class NewSessionWizard extends Wizard implements INewWizard { }); } catch (final InterruptedException e) { - IStatus status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, SESSION_CREATION_ERROR_MSG, e); + IStatus status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, Messages.NewSessionWizard_representationFileCreationError, e); SiriusEditPlugin.getPlugin().getLog().log(status); finished = false; } catch (final InvocationTargetException e) { - IStatus status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, SESSION_CREATION_ERROR_MSG, e.getTargetException()); + IStatus status = new Status(IStatus.ERROR, SiriusEditPlugin.ID, Messages.NewSessionWizard_representationFileCreationError, e.getTargetException()); SiriusEditPlugin.getPlugin().getLog().log(status); finished = false; } @@ -241,7 +220,7 @@ public class NewSessionWizard extends Wizard implements INewWizard { /** * A local class to create a session. - * + * * @author mchauvin */ private static final class SessionCreationOperation extends WorkspaceModifyOperation { @@ -265,11 +244,11 @@ public class NewSessionWizard extends Wizard implements INewWizard { @Override protected void execute(final IProgressMonitor monitor) throws CoreException, InterruptedException { try { - monitor.beginTask("Representations file creation", 1); + monitor.beginTask(Messages.NewSessionWizard_fileCreationTask, 1); // Create a Session from the session model URI - org.eclipse.sirius.business.api.session.SessionCreationOperation sessionCreationOperation = new DefaultLocalSessionCreationOperation(sessionModelURI, new SubProgressMonitor( - monitor, 1)); + org.eclipse.sirius.business.api.session.SessionCreationOperation sessionCreationOperation = new DefaultLocalSessionCreationOperation(sessionModelURI, + new SubProgressMonitor(monitor, 1)); sessionCreationOperation.execute(); session = sessionCreationOperation.getCreatedSession(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/SelectRepresentationsWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/SelectRepresentationsWizard.java index d7571e3d10..193f0f51c1 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/SelectRepresentationsWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/SelectRepresentationsWizard.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -18,13 +18,14 @@ import org.eclipse.sirius.business.api.helper.SiriusUtil; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.ui.tools.internal.wizards.pages.RepresentationsSelectionWizardPage; import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * This wizard ask the user for which viewpoints he wants to externalize and * create the new .aird files. - * + * * @author cbrun - * + * */ public class SelectRepresentationsWizard extends Wizard { @@ -36,7 +37,7 @@ public class SelectRepresentationsWizard extends Wizard { /** * Constructor. - * + * * @param session * origin session. * @param preselection @@ -51,26 +52,16 @@ public class SelectRepresentationsWizard extends Wizard { * Initialize the wizard. */ public void init() { - setWindowTitle("Wizard of representations selection"); + setWindowTitle(Messages.SelectRepresentationsWizard_title); setNeedsProgressMonitor(false); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ @Override public boolean performFinish() { representations = selectElementPage.getSelectedElements(); return true; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ @Override public void addPages() { final Collection<String> extensions = new ArrayList<String>(); @@ -83,10 +74,6 @@ public class SelectRepresentationsWizard extends Wizard { return representations; } - /** - * - * {@inheritDoc} - */ @Override public void dispose() { super.dispose(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/CreateOrAddResourceWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/CreateOrAddResourceWizardPage.java index c09c7ce4b2..71e932a06f 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/CreateOrAddResourceWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/CreateOrAddResourceWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -12,6 +12,7 @@ package org.eclipse.sirius.ui.tools.internal.wizards.pages; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -21,7 +22,7 @@ import org.eclipse.swt.widgets.Listener; /** * A wizard page to choose Session kind. - * + * * @author mchauvin */ public class CreateOrAddResourceWizardPage extends WizardPage { @@ -32,20 +33,16 @@ public class CreateOrAddResourceWizardPage extends WizardPage { /** * Constructor. - * + * * @param pageName * the page name. */ public CreateOrAddResourceWizardPage(final String pageName) { super(pageName); - setDescription("Create or select existing resource"); + setDescription(Messages.CreateOrAddResourceWizardPage_description); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { control = SWTUtil.createCompositeBothFill(parent, 1, false); @@ -59,6 +56,7 @@ public class CreateOrAddResourceWizardPage extends WizardPage { createButton.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(final Event event) { final Button button = (Button) event.widget; createResource = button.getSelection(); @@ -66,24 +64,24 @@ public class CreateOrAddResourceWizardPage extends WizardPage { } }); - createButton.setText("Create resource"); + createButton.setText(Messages.CreateOrAddResourceWizardPage_createResource_label); final Label emptyLabel = new Label(control, SWT.NONE); - emptyLabel.setText(" Create a new empty resource and add it to the representations file."); + emptyLabel.setText(" " + Messages.CreateOrAddResourceWizardPage_createResource_details); //$NON-NLS-1$ new Label(control, SWT.NONE); new Label(control, SWT.NONE); final Button resourceButton = new Button(control, SWT.RADIO); - resourceButton.setText("Add existing resource"); + resourceButton.setText(Messages.CreateOrAddResourceWizardPage_addResource_label); final Label resourceLabel = new Label(control, SWT.NONE); - resourceLabel.setText(" Add an existing resource to the representations file"); + resourceLabel.setText(" " + Messages.CreateOrAddResourceWizardPage_addResource_details); //$NON-NLS-1$ setControl(control); } /** * Return whether the wizard should create a new resource. - * + * * @return <code>true</code> if the wizard should create a new resource, * <code>false</code> otherwise */ diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericInitialObjectPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericInitialObjectPage.java index e6b5d27693..bca75e66af 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericInitialObjectPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericInitialObjectPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EPackage; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -34,7 +35,7 @@ import org.eclipse.swt.widgets.Label; /** * A generic wizard page to select root object and encodings. - * + * * @author mchauvin */ public class GenericInitialObjectPage extends WizardPage { @@ -67,6 +68,7 @@ public class GenericInitialObjectPage extends WizardPage { * . */ protected ModifyListener validator = new ModifyListener() { + @Override public void modifyText(final ModifyEvent e) { setPageComplete(validatePage()); } @@ -74,7 +76,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Construct a new wizard page to select root object and encoding. - * + * * @param pageId * the page id */ @@ -84,7 +86,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Set the package. - * + * * @param ePackage * the package to set */ @@ -102,7 +104,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Returns the names of the types that can be created as the root object. - * + * * @return the names of the types that can be created. */ protected Collection<String> getInitialObjectNames() { @@ -123,7 +125,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Get all the available encodings. - * + * * @return the available encodings */ protected Collection<String> getEncodings() { @@ -139,11 +141,7 @@ public class GenericInitialObjectPage extends WizardPage { return encodings; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); @@ -160,7 +158,7 @@ public class GenericInitialObjectPage extends WizardPage { final Label containerLabel = new Label(composite, SWT.LEFT); - containerLabel.setText("&Model Object"); + containerLabel.setText(Messages.GenericInitialObjectPage_containerLabel); final GridData containerData = new GridData(); containerData.horizontalAlignment = GridData.FILL; @@ -178,10 +176,12 @@ public class GenericInitialObjectPage extends WizardPage { initialObjectField.addModifyListener(validator); // Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=294192 initialObjectField.addSelectionListener(new SelectionListener() { + @Override public void widgetSelected(SelectionEvent e) { setPageComplete(validatePage()); } + @Override public void widgetDefaultSelected(SelectionEvent e) { } }); @@ -189,7 +189,7 @@ public class GenericInitialObjectPage extends WizardPage { final Label encodingLabel = new Label(composite, SWT.LEFT); - encodingLabel.setText("&XML Encoding"); + encodingLabel.setText(Messages.GenericInitialObjectPage_encodingLabel); final GridData encodingLabelData = new GridData(); encodingLabelData.horizontalAlignment = GridData.FILL; encodingLabel.setLayoutData(encodingLabelData); @@ -224,7 +224,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Check if this page validates. - * + * * @return <code>true</code> if this page validates, <code>false</code> * otherwise */ @@ -232,11 +232,6 @@ public class GenericInitialObjectPage extends WizardPage { return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean) - */ @Override public void setVisible(final boolean visible) { super.setVisible(visible); @@ -253,7 +248,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Get the root object name. - * + * * @return the root object name. */ public String getInitialObjectName() { @@ -269,7 +264,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Get the encoding. - * + * * @return the encoding */ public String getEncoding() { @@ -278,7 +273,7 @@ public class GenericInitialObjectPage extends WizardPage { /** * Returns the label for the specified type name. - * + * * @param typeName * the type name * @return the label diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericModelCreationPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericModelCreationPage.java index 9ac132bb9d..2a97427a21 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericModelCreationPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/GenericModelCreationPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -10,15 +10,18 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.wizards.pages; +import java.text.MessageFormat; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; /** * A wizard page to create any model file in the workspace. - * + * * @author mchauvin */ public class GenericModelCreationPage extends WizardNewFileCreationPage { @@ -27,7 +30,7 @@ public class GenericModelCreationPage extends WizardNewFileCreationPage { /** * Construct a new wizard page instance. - * + * * @param pageName * the page name * @param selection @@ -39,7 +42,7 @@ public class GenericModelCreationPage extends WizardNewFileCreationPage { /** * Get the created model file. - * + * * @return the created model file */ public IFile getModelFile() { @@ -48,7 +51,7 @@ public class GenericModelCreationPage extends WizardNewFileCreationPage { /** * Set the model file extension. - * + * * @param modelFileExtension * the model file extension. */ @@ -56,11 +59,6 @@ public class GenericModelCreationPage extends WizardNewFileCreationPage { this.fileExtension = modelFileExtension; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage() - */ @Override protected boolean validatePage() { if (super.validatePage()) { @@ -68,7 +66,7 @@ public class GenericModelCreationPage extends WizardNewFileCreationPage { if (fileExtension == null || (enteredExt != null && enteredExt.equals(fileExtension))) { return true; } else { - setErrorMessage("The file name must end in ." + fileExtension); + setErrorMessage(MessageFormat.format(Messages.GenericModelCreationPage_fileExtensionError, fileExtension)); } } return false; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationSelectionWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationSelectionWizardPage.java index 68dec31913..e8d79540e0 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationSelectionWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationSelectionWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -35,6 +35,7 @@ import org.eclipse.sirius.ui.tools.internal.views.common.navigator.sorter.Common import org.eclipse.sirius.viewpoint.DRepresentationContainer; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -46,23 +47,15 @@ import com.google.common.collect.Lists; /** * Page to select representations from an Aird. - * + * * @author nlepine */ public class RepresentationSelectionWizardPage extends WizardPage { - private static final String SELECT_REPRESENTATIONS = "Select a representation type"; - - private static final String READ_ONLY_REPRESENTATION_CONTAINER = "The representation container is read only.\r\n Please select another representation type."; - - /** The title of the page. */ - private static final String PAGE_TITLE = "Create a new representation"; - /** The table viewer. */ private TreeViewer treeViewer; /** The filter. */ - private final Session root; private Composite pageComposite; @@ -73,15 +66,15 @@ public class RepresentationSelectionWizardPage extends WizardPage { /** * Create a new <code>RepresentationSelectionWizardPage</code>. - * + * * @param root * the root object */ public RepresentationSelectionWizardPage(final Session root) { - super(PAGE_TITLE); - this.setTitle(PAGE_TITLE); + super(Messages.RepresentationSelectionWizardPage_title); + this.setTitle(Messages.RepresentationSelectionWizardPage_title); this.root = root; - setMessage(SELECT_REPRESENTATIONS); + setMessage(Messages.RepresentationSelectionWizardPage_message); } @Override @@ -115,7 +108,7 @@ public class RepresentationSelectionWizardPage extends WizardPage { if (result) { setRepresentation(representationDescription); } else { - setErrorMessage(READ_ONLY_REPRESENTATION_CONTAINER); + setErrorMessage(Messages.RepresentationSelectionWizardPage_errorReadonlyContainer); } } @@ -173,7 +166,7 @@ public class RepresentationSelectionWizardPage extends WizardPage { /** * Create the table viewer. - * + * * @param parent * the parent composite. * @return the table viewer. @@ -194,7 +187,7 @@ public class RepresentationSelectionWizardPage extends WizardPage { /** * return if the page is the current page. - * + * * @return if the page is the current page. */ public boolean isCurrentPageOnWizard() { @@ -217,7 +210,7 @@ public class RepresentationSelectionWizardPage extends WizardPage { @Override public Object[] getChildren(final Object parentElement) { - Object[] children = empty; + Object[] children = SessionContentProvider.empty; if (parentElement instanceof Session) { children = ((Session) parentElement).getSelectedViewpoints(false).toArray(); } else if (parentElement instanceof Viewpoint) { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationsSelectionWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationsSelectionWizardPage.java index 49cbc22bc9..6b9bdd0745 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationsSelectionWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/RepresentationsSelectionWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -38,6 +38,7 @@ import org.eclipse.sirius.ui.tools.api.views.ViewHelper; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationContainer; import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -50,17 +51,13 @@ import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer; /** * Wizard to select representations from an Aird. - * + * * @author cbrun */ public class RepresentationsSelectionWizardPage extends WizardPage { - private static final String SELECT_REPRESENTATIONS_TO_EXPORT = "Select Representations to export"; - - private static final String READ_ONLY_REPRESENTATION_CONTAINER = "The representation container is read only.\r\n Please select another representation."; - /** The title of the page. */ - private static final String PAGE_TITLE = "Selection of representations to export"; + private static final String PAGE_TITLE = Messages.RepresentationsSelectionWizardPage_pageTitle; /** The page is completed. */ private static final int CODE_OK = 0; @@ -85,21 +82,21 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Create a new <code>DescDiagramSelectionWizardPage</code>. - * + * * @param root * the root object * @param representations * the preselection. */ public RepresentationsSelectionWizardPage(final Session root, final Collection<DRepresentation> representations) { - super(PAGE_TITLE); - this.setTitle(PAGE_TITLE); + super(RepresentationsSelectionWizardPage.PAGE_TITLE); + this.setTitle(RepresentationsSelectionWizardPage.PAGE_TITLE); this.root = root; this.preselection = representations; if (preselection.size() > 0) { setPageComplete(true); } - setMessage(SELECT_REPRESENTATIONS_TO_EXPORT, IMessageProvider.INFORMATION); + setMessage(Messages.RepresentationsSelectionWizardPage_message, IMessageProvider.INFORMATION); } @Override @@ -125,7 +122,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Create the table viewer. - * + * * @param parent * the parent composite. * @return the table viewer. @@ -146,7 +143,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Change the page according to the new state of the selection. - * + * * @author cbrun */ private class SiriusDiagramSelectionCheckStateListener implements ICheckStateListener { @@ -156,15 +153,15 @@ public class RepresentationsSelectionWizardPage extends WizardPage { switch (result) { case CODE_OK: case CODE_NO_SEL: - setMessage(SELECT_REPRESENTATIONS_TO_EXPORT, IMessageProvider.INFORMATION); + setMessage(Messages.RepresentationsSelectionWizardPage_message, IMessageProvider.INFORMATION); setPageComplete(true); break; case CODE_ERROR_READONLY: - setMessage(READ_ONLY_REPRESENTATION_CONTAINER, IMessageProvider.ERROR); + setMessage(Messages.RepresentationsSelectionWizardPage_readOnlyContainerError, IMessageProvider.ERROR); setPageComplete(false); break; default: - setMessage("Unknown code result", IMessageProvider.ERROR); + setMessage(Messages.RepresentationsSelectionWizardPage_unknownCodeError, IMessageProvider.ERROR); setPageComplete(false); break; } @@ -172,9 +169,9 @@ public class RepresentationsSelectionWizardPage extends WizardPage { } private int checkSelection(final Collection<DRepresentation> selectedRepresentations) { - int result = CODE_OK; + int result = RepresentationsSelectionWizardPage.CODE_OK; if (selectedRepresentations.isEmpty()) { - result = CODE_NO_SEL; + result = RepresentationsSelectionWizardPage.CODE_NO_SEL; } else { for (DRepresentation item : selectedRepresentations) { // check permission authority @@ -183,7 +180,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(container); if (permissionAuthority != null && !permissionAuthority.canDeleteInstance(item)) { // Cannot remove representation from the container - result = CODE_ERROR_READONLY; + result = RepresentationsSelectionWizardPage.CODE_ERROR_READONLY; break; // quit the while } } @@ -194,14 +191,14 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Selects only diagrams. - * + * * @author cbrun */ private class DescDiagramSelectionTreeViewer extends ContainerCheckedTreeViewer { /** * Create a new <code>DescDiagramSelectionTreeViewer</code>. - * + * * @param parent * the parent composite. */ @@ -211,7 +208,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Create a new <code>DescDiagramSelectionTreeViewer</code>. - * + * * @param parent * the parent composite. * @param style @@ -223,7 +220,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Create a new <code>DescDiagramSelectionTreeViewer</code>. - * + * * @param tree * the tree. */ @@ -273,7 +270,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Updates the check state of all created children - * + * * @return <code>true</code> if an element as been checked. */ private boolean updateChildrenItems(final TreeItem parent, final boolean state) { @@ -304,7 +301,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Return all selected elements. - * + * * @return all selected elements. */ @SuppressWarnings("unchecked") @@ -330,7 +327,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Create a new <code>SemanticDViewContentProvider</code> with the * specified analysis. - * + * * @param functionnalAnalysis * the analysis to browse. */ @@ -342,7 +339,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { @Override public Object[] getChildren(final Object parentElement) { - Object[] children = empty; + Object[] children = SessionContentProvider.empty; if (parentElement instanceof Session) { children = ((Session) parentElement).getSemanticResources().toArray(); } else if (parentElement instanceof Resource) { @@ -415,7 +412,7 @@ public class RepresentationsSelectionWizardPage extends WizardPage { /** * Return all the diagrams for the specified viewpoint. - * + * * @param semanticElement * the parent semantic element. * @return all the diagrams for the specified viewpoint. diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectAnalysisFilePage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectAnalysisFilePage.java index e272b8926c..82475496c5 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectAnalysisFilePage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectAnalysisFilePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -26,6 +26,7 @@ import org.eclipse.sirius.business.api.helper.SiriusUtil; import org.eclipse.sirius.common.tools.api.util.StringUtil; import org.eclipse.sirius.common.ui.tools.api.dialog.FolderSelectionDialog; import org.eclipse.sirius.common.ui.tools.api.dialog.NewFileDialog; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; @@ -42,7 +43,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; /** * A wizard page to select a viewpoint analysis model file. - * + * * @author cbrun */ public class SelectAnalysisFilePage extends WizardPage { @@ -78,7 +79,7 @@ public class SelectAnalysisFilePage extends WizardPage { /** * Constructor. - * + * * @param pageName * the page name */ @@ -89,7 +90,7 @@ public class SelectAnalysisFilePage extends WizardPage { /** * Get the selected file. - * + * * @return the file path the user selected in the form of * "/project/folder/file.aird" */ @@ -97,14 +98,10 @@ public class SelectAnalysisFilePage extends WizardPage { return selectedFilePath; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { initializeDialogUnits(parent); - setDescription("Select the destination file for the views"); + setDescription(Messages.SelectAnalysisFilePage_description); // top level group final Composite topLevel = new Composite(parent, SWT.NONE); topLevel.setFont(parent.getFont()); @@ -129,18 +126,20 @@ public class SelectAnalysisFilePage extends WizardPage { } private void createFolderExportGroup(final Composite parent) { - String groupLabel = "Extract in one distinct file per view"; - String pickButtonLabel = "Folder"; + String groupLabel = Messages.SelectAnalysisFilePage_folderExportGroup; + String pickButtonLabel = Messages.SelectAnalysisFilePage_folderExportGroup_button; exportFolderGroup = createExportGroup(parent, groupLabel); pickFolder = createPickButton(pickButtonLabel, exportFolderGroup); pickFolder.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { /* * new file panel @@ -169,9 +168,11 @@ public class SelectAnalysisFilePage extends WizardPage { exportFolderBrowse = createBroweButton(exportFolderGroup); exportFolderBrowse.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { browseForFolder(); @@ -185,26 +186,28 @@ public class SelectAnalysisFilePage extends WizardPage { gridData2.verticalAlignment = GridData.CENTER; Button browseButton = new Button(parentGroup, SWT.NONE); - browseButton.setText("Browse..."); + browseButton.setText(Messages.SelectAnalysisFilePage_browseButton); browseButton.setLayoutData(gridData2); return browseButton; } /** * This method initializes the new file group - * + * */ private void createNewFileGroup(final Composite parent) { - String groupLabel = "Extract in one distinct file per view"; - String pickButtonLabel = "New File"; + String groupLabel = Messages.SelectAnalysisFilePage_newFileGroup; + String pickButtonLabel = Messages.SelectAnalysisFilePage_newFileGroup_button; newFileGroup = createExportGroup(parent, groupLabel); pickNewFile = createPickButton(pickButtonLabel, newFileGroup); pickNewFile.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { /* * my panel @@ -230,9 +233,11 @@ public class SelectAnalysisFilePage extends WizardPage { newFileBrowse = createBroweButton(newFileGroup); newFileBrowse.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { browseForNewFile(); } @@ -274,14 +279,15 @@ public class SelectAnalysisFilePage extends WizardPage { } private void browseForNewFile() { - final NewFileDialog dialog = new NewFileDialog("newfile." + SiriusUtil.SESSION_RESOURCE_EXTENSION); + final NewFileDialog dialog = new NewFileDialog(Messages.SelectAnalysisFilePage_defaultFileName + "." + SiriusUtil.SESSION_RESOURCE_EXTENSION); //$NON-NLS-1$ if (dialog.open() == Window.OK && dialog.getFirstResult() instanceof IContainer) { final IContainer folder = (IContainer) dialog.getFirstResult(); final String newFileName = dialog.getNewFileName(); if (!StringUtil.isEmpty(folder.getProjectRelativePath().toOSString())) { - selectedFilePath = SEPARATOR + folder.getProject().getName() + SEPARATOR + folder.getProjectRelativePath() + SEPARATOR + newFileName; + selectedFilePath = SelectAnalysisFilePage.SEPARATOR + folder.getProject().getName() + SelectAnalysisFilePage.SEPARATOR + folder.getProjectRelativePath() + + SelectAnalysisFilePage.SEPARATOR + newFileName; } else { - selectedFilePath = SEPARATOR + folder.getProject().getName() + SEPARATOR + newFileName; + selectedFilePath = SelectAnalysisFilePage.SEPARATOR + folder.getProject().getName() + SelectAnalysisFilePage.SEPARATOR + newFileName; } newFilePath.setText(selectedFilePath); validate(); @@ -289,13 +295,14 @@ public class SelectAnalysisFilePage extends WizardPage { } private void browseForFolder() { - final FolderSelectionDialog dialog = new FolderSelectionDialog("Please select a Folder"); + final FolderSelectionDialog dialog = new FolderSelectionDialog(Messages.SelectAnalysisFilePage_folderSelectionDialogTitle); if (dialog.open() == Window.OK && dialog.getFirstResult() instanceof IContainer) { final IContainer folder = (IContainer) dialog.getFirstResult(); if (!StringUtil.isEmpty(folder.getProjectRelativePath().toOSString())) { - selectedFilePath = SEPARATOR + folder.getProject().getName() + SEPARATOR + folder.getProjectRelativePath() + SEPARATOR; + selectedFilePath = SelectAnalysisFilePage.SEPARATOR + folder.getProject().getName() + SelectAnalysisFilePage.SEPARATOR + folder.getProjectRelativePath() + + SelectAnalysisFilePage.SEPARATOR; } else { - selectedFilePath = SEPARATOR + folder.getProject().getName() + SEPARATOR; + selectedFilePath = SelectAnalysisFilePage.SEPARATOR + folder.getProject().getName() + SelectAnalysisFilePage.SEPARATOR; } exportFolderPath.setText(selectedFilePath); } @@ -318,14 +325,16 @@ public class SelectAnalysisFilePage extends WizardPage { gridData1.verticalAlignment = GridData.FILL; existingFileGroup = new Group(parent, SWT.NONE); existingFileGroup.setLayout(new GridLayout()); - existingFileGroup.setText("Extract in an existing file"); + existingFileGroup.setText(Messages.SelectAnalysisFilePage_existingFileGroup); existingFileGroup.setLayoutData(gridData1); pickExistingFile = new Button(existingFileGroup, SWT.RADIO); - pickExistingFile.setText("Existing File"); + pickExistingFile.setText(Messages.SelectAnalysisFilePage_existingFileGroup_button); pickExistingFile.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { /* * new file panel @@ -347,7 +356,7 @@ public class SelectAnalysisFilePage extends WizardPage { final Object element = ((StructuredSelection) workspaceViewer.getSelection()).getFirstElement(); if (element instanceof IFile) { final IFile file = (IFile) element; - selectedFilePath = SEPARATOR + file.getProject().getName() + SEPARATOR + file.getProjectRelativePath().toOSString(); + selectedFilePath = SelectAnalysisFilePage.SEPARATOR + file.getProject().getName() + SelectAnalysisFilePage.SEPARATOR + file.getProjectRelativePath().toOSString(); } validate(); } @@ -387,13 +396,14 @@ public class SelectAnalysisFilePage extends WizardPage { } }); workspaceViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(final SelectionChangedEvent event) { selectedFilePath = null; if (event.getSelection() instanceof StructuredSelection) { final Object element = ((StructuredSelection) event.getSelection()).getFirstElement(); if (element instanceof IFile) { final IFile file = (IFile) element; - selectedFilePath = SEPARATOR + file.getProject().getName() + SEPARATOR + file.getProjectRelativePath().toOSString(); + selectedFilePath = SelectAnalysisFilePage.SEPARATOR + file.getProject().getName() + SelectAnalysisFilePage.SEPARATOR + file.getProjectRelativePath().toOSString(); } } validate(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectMetamodelWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectMetamodelWizardPage.java index 78f21d4c3b..670c2b9ea4 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectMetamodelWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SelectMetamodelWizardPage.java @@ -1,6 +1,5 @@ -/* - * Copyright (c) 2005-2007 Obeo - * +/******************************************************************************* + * Copyright (c) 2005, 2015 Obeo. * 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 @@ -8,8 +7,7 @@ * * Contributors: * Obeo - initial API and implementation - */ - + *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.wizards.pages; import java.util.Arrays; @@ -24,6 +22,7 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EPackage; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.sirius.common.ui.tools.api.resource.WorkspaceResourceDialog; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; @@ -42,7 +41,7 @@ import org.eclipse.ui.PlatformUI; /** * The role of this wizard page is to select an ecore metamodel, in the * workspace or in the registry (EPackage). - * + * * @author www.obeo.fr */ public class SelectMetamodelWizardPage extends WizardPage { @@ -74,7 +73,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Constructor. - * + * * @param pageName * is the name of the page * @param extensions @@ -86,7 +85,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Constructor. - * + * * @param pageName * is the name of the page * @param extensions @@ -97,16 +96,12 @@ public class SelectMetamodelWizardPage extends WizardPage { public SelectMetamodelWizardPage(final String pageName, final String[] extensions, final boolean chooseMetamodelType) { super(pageName); setTitle(pageName); - setDescription("This page is used to specify the URI of the metamodel"); //$NON-NLS-1$ + setDescription(Messages.SelectMetamodelWizardPage_description); this.extensions = extensions; this.chooseMetamodelType = chooseMetamodelType; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { final Composite rootContainer = new Composite(parent, SWT.NULL); final GridLayout rootContainerLayout = new GridLayout(); @@ -116,37 +111,31 @@ public class SelectMetamodelWizardPage extends WizardPage { rootContainerLayout.marginLeft = 5; rootContainerLayout.marginRight = 5; rootContainer.setLayout(rootContainerLayout); - final Composite registryContainer = new Composite(rootContainer, SWT.NULL); final GridLayout registryContainerLayout = new GridLayout(); registryContainerLayout.numColumns = 3; registryContainerLayout.verticalSpacing = 3; registryContainer.setLayout(registryContainerLayout); - final Label registryLabel = new Label(registryContainer, SWT.NULL); - registryLabel.setText("&Registry values" + ':'); //$NON-NLS-1$ - + registryLabel.setText(Messages.SelectMetamodelWizardPage_registryLabel); final Set<String> registryValues = new TreeSet<String>(EPackage.Registry.INSTANCE.keySet()); final String[] valueLabels = registryValues.toArray(new String[registryValues.size()]); final Combo comboBox = new Combo(registryContainer, SWT.READ_ONLY); comboBox.setItems(valueLabels); - final int visibleItemCount = 15; - if (valueLabels.length < visibleItemCount) { - comboBox.setVisibleItemCount(valueLabels.length); - } else { - comboBox.setVisibleItemCount(visibleItemCount); - } + comboBox.setVisibleItemCount(Math.min(valueLabels.length, 15)); comboBox.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { metamodelURI.setText(valueLabels[((Combo) e.widget).getSelectionIndex()]); } }); final Button button = new Button(registryContainer, SWT.PUSH); - button.setText("Browse..."); //$NON-NLS-1$ + button.setText(Messages.SelectMetamodelWizardPage_browseButton); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { @@ -163,13 +152,14 @@ public class SelectMetamodelWizardPage extends WizardPage { uriContainer.setLayout(uriContainerLayout); final Label uriLabel = new Label(uriContainer, SWT.NULL); - uriLabel.setText("&Metamodel URI" + ':'); //$NON-NLS-1$ + uriLabel.setText(Messages.SelectMetamodelWizardPage_uriLabel); metamodelURI = new Text(uriContainer, SWT.BORDER | SWT.SINGLE); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; metamodelURI.setLayoutData(gridData); metamodelURI.addModifyListener(new ModifyListener() { + @Override public void modifyText(final ModifyEvent e) { updateTypes(); dialogChanged(); @@ -187,30 +177,31 @@ public class SelectMetamodelWizardPage extends WizardPage { typeContainer.setLayout(typeContainerLayout); final Label typeLabel = new Label(typeContainer, SWT.NULL); - typeLabel.setText("&Type values" + ':'); + typeLabel.setText(Messages.SelectMetamodelWizardPage_typeValues); metamodelType = new Combo(typeContainer, SWT.READ_ONLY); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 4; metamodelType.setLayoutData(gridData); metamodelType.addSelectionListener(new SelectionListener() { + @Override public void widgetDefaultSelected(final SelectionEvent e) { } + @Override public void widgetSelected(final SelectionEvent e) { dialogChanged(); } }); } - updateTypes(); dialogChanged(); setControl(rootContainer); } private void handleBrowse() { - final WorkspaceResourceDialog dialog = new WorkspaceResourceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SINGLE, "Select the metamodel in the workspace", - Arrays.asList(extensions)); + final WorkspaceResourceDialog dialog = new WorkspaceResourceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.SINGLE, + Messages.SelectMetamodelWizardPage_workspaceDialogTitle, Arrays.asList(extensions)); dialog.open(); if (dialog.getSelectedResources() != null && !dialog.getSelectedResources().isEmpty()) { metamodelURI.setText(dialog.getSelectedResources().get(0).getFullPath().toString()); @@ -266,7 +257,7 @@ public class SelectMetamodelWizardPage extends WizardPage { * <p> * Sample : "resources.JavaFile" is the short path for the classifier * java.resources.JavaFile - * + * * @param eClassifier * is the classifier * @return short path of the classifier @@ -285,7 +276,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Search all the classifiers recursively in a package. - * + * * @param ePackage * is the container * @return list of classifiers @@ -296,7 +287,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Search all the classifiers recursively in a package. - * + * * @param ePackage * is the container * @param classOnly @@ -360,11 +351,11 @@ public class SelectMetamodelWizardPage extends WizardPage { private void dialogChanged() { final String mmURI = getMetamodelURI(); if (mmURI.length() == 0) { - updateStatus("Metamodel URI must be specified"); + updateStatus(Messages.SelectMetamodelWizardPage_statusNoURI); } else if (SelectMetamodelWizardPage.getEPackage(mmURI) == null) { - updateStatus("Metamodel URI doesn't exist"); + updateStatus(Messages.SelectMetamodelWizardPage_statusUnknownURI); } else if (chooseMetamodelType && getMetamodelType().length() == 0) { - updateStatus("Metamodel type is not selected"); + updateStatus(Messages.SelectMetamodelWizardPage_noMetamodelType); } else { updateStatus(null); } @@ -372,7 +363,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Updates the status of the page. - * + * * @param message * is the error message. */ @@ -383,7 +374,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Returns the metamodel URI. - * + * * @return the metamodel URI */ public String getMetamodelURI() { @@ -392,7 +383,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Returns the package associated with the current metamodel uri. - * + * * @return the package */ public EPackage getEPackage() { @@ -401,7 +392,7 @@ public class SelectMetamodelWizardPage extends WizardPage { /** * Returns the metamodel type. - * + * * @return the metamodel type */ public String getMetamodelType() { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SemanticElementSelectionWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SemanticElementSelectionWizardPage.java index 726b1df596..06d0f2d1e2 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SemanticElementSelectionWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SemanticElementSelectionWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 2015 THALES GLOBAL SERVICES 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 @@ -27,6 +27,7 @@ import org.eclipse.sirius.common.tools.api.util.ReflectionHelper; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; import org.eclipse.sirius.ui.tools.api.views.ViewHelper; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -36,16 +37,10 @@ import org.eclipse.ui.dialogs.PatternFilter; /** * Page to select the semantic element of the new representation. - * + * * @author nlepine */ public class SemanticElementSelectionWizardPage extends WizardPage { - - private static final String SELECT_SEMANTIC_ELEMENT = "Select a semantic element for the new representation"; - - /** The title of the page. */ - private static final String PAGE_TITLE = "Create a new representation"; - /** The composite control of the page. */ private Composite pageComposite; @@ -62,22 +57,18 @@ public class SemanticElementSelectionWizardPage extends WizardPage { /** * Create a new <code>SemanticElementSelectionWizardPage</code>. - * + * * @param root * the root object */ public SemanticElementSelectionWizardPage(final Session root) { - super(PAGE_TITLE); - this.setTitle(PAGE_TITLE); + super(Messages.SemanticElementSelectionWizardPage_title); + this.setTitle(Messages.SemanticElementSelectionWizardPage_title); this.root = root; - setMessage(SELECT_SEMANTIC_ELEMENT); + setMessage(Messages.SemanticElementSelectionWizardPage_message); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { initializeDialogUnits(parent); @@ -88,6 +79,7 @@ public class SemanticElementSelectionWizardPage extends WizardPage { this.treeViewer = createTreeViewer(pageComposite); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { setPageComplete(isPageComplete()); } @@ -99,7 +91,7 @@ public class SemanticElementSelectionWizardPage extends WizardPage { /** * Create the table viewer. - * + * * @param parent * the parent composite. * @return the table viewer. @@ -113,7 +105,7 @@ public class SemanticElementSelectionWizardPage extends WizardPage { * slightly improved user experience by automatically selecting the * first element which matches the filter and is selectable. */ - ReflectionHelper.invokeMethodWithoutException(tree, "setQuickSelectionMode", new Class[] { Boolean.TYPE }, new Object[] { true }); + ReflectionHelper.invokeMethodWithoutException(tree, "setQuickSelectionMode", new Class[] { Boolean.TYPE }, new Object[] { true }); //$NON-NLS-1$ final TreeViewer viewer = tree.getViewer(); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); @@ -127,7 +119,7 @@ public class SemanticElementSelectionWizardPage extends WizardPage { /** * Return the selected element. - * + * * @return all selected elements. */ public EObject getSelectedElement() { @@ -139,11 +131,7 @@ public class SemanticElementSelectionWizardPage extends WizardPage { return null; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.WizardPage#isPageComplete() - */ + @Override public boolean isPageComplete() { return getSelectedElement() != null; } @@ -154,18 +142,14 @@ public class SemanticElementSelectionWizardPage extends WizardPage { /** * Create a new <code>SemanticContentProvider</code>. - * + * */ public SessionContentProvider() { } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object) - */ + @Override public Object[] getChildren(final Object parentElement) { - Object[] children = empty; + Object[] children = SessionContentProvider.empty; if (parentElement instanceof Session) { children = ((Session) parentElement).getSemanticResources().toArray(); } else if (parentElement instanceof EObject) { @@ -176,47 +160,26 @@ public class SemanticElementSelectionWizardPage extends WizardPage { return children; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) - */ + @Override public Object getParent(final Object element) { return null; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object) - */ + @Override public boolean hasChildren(final Object element) { return getChildren(element).length > 0; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ + @Override public Object[] getElements(final Object inputElement) { return getChildren(inputElement); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ + @Override public void dispose() { } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, - * java.lang.Object, java.lang.Object) - */ + @Override public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) { // empty } @@ -224,7 +187,7 @@ public class SemanticElementSelectionWizardPage extends WizardPage { /** * Set the representation. - * + * * @param representation * RepresentationDescription */ @@ -250,9 +213,9 @@ public class SemanticElementSelectionWizardPage extends WizardPage { /** * Viewer filter for representation creation on EObject. - * + * * @author nlepine - * + * */ private class EObjectFilter extends PatternFilter { diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionFileCreationWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionFileCreationWizardPage.java index d179200844..cb3f657a24 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionFileCreationWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionFileCreationWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -21,17 +21,18 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.sirius.business.api.helper.SiriusUtil; import org.eclipse.sirius.business.api.modelingproject.ModelingProject; import org.eclipse.sirius.common.tools.api.util.WorkspaceUtil; +import org.eclipse.sirius.viewpoint.provider.Messages; /** * Wizard page to create a new Session file. - * + * * @author mchauvin */ public class SessionFileCreationWizardPage extends SessionResourceCreationWizardPage { /** * Constructor. - * + * * @param pageName * the page name. * @param selection @@ -41,22 +42,15 @@ public class SessionFileCreationWizardPage extends SessionResourceCreationWizard */ public SessionFileCreationWizardPage(final String pageName, final IStructuredSelection selection, final String fileExtension) { super(pageName, selection, fileExtension); - setTitle("Representations File"); - setDescription("Create a new representations file resource"); + setTitle(Messages.SessionFileCreationWizardPage_title); + setDescription(Messages.SessionFileCreationWizardPage_description); } - /** - * {@inheritDoc} - */ + @Override protected String getNoselectionFileName() { - return "representations"; //$NON-NLS-1$ + return Messages.SessionFileCreationWizardPage_noSelectionFileName; } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage() - */ @Override protected boolean validatePage() { boolean result = true; @@ -65,7 +59,7 @@ public class SessionFileCreationWizardPage extends SessionResourceCreationWizard boolean isValidForModelingProject = noSecondaryAirdCreationForModelingProject(getFilePath()); if (!isValidForModelingProject) { result = false; - setErrorMessage("The selected Modeling Project already has its representations file"); + setErrorMessage(Messages.SessionFileCreationWizardPage_errorMessage); } else { // 2. Normal file validation result = super.validatePage(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionKindSelectionWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionKindSelectionWizardPage.java index 9cf93062d4..352db1292c 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionKindSelectionWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionKindSelectionWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES 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 @@ -13,6 +13,7 @@ package org.eclipse.sirius.ui.tools.internal.wizards.pages; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; @@ -22,7 +23,7 @@ import org.eclipse.swt.widgets.Listener; /** * A wizard page to choose Session kind. - * + * * @author mchauvin */ public class SessionKindSelectionWizardPage extends WizardPage { @@ -33,7 +34,7 @@ public class SessionKindSelectionWizardPage extends WizardPage { /** * Create the page. - * + * * @param pageName * the page's name. * @param defaultToEmptyModel @@ -42,16 +43,12 @@ public class SessionKindSelectionWizardPage extends WizardPage { */ public SessionKindSelectionWizardPage(final String pageName, final boolean defaultToEmptyModel) { super(pageName); - setTitle("Representations File"); - setDescription("Choose initialization kind"); + setTitle(Messages.SessionKindSelectionWizardPage_title); + setDescription(Messages.SessionKindSelectionWizardPage_description); this.emptyModel = defaultToEmptyModel; } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ + @Override public void createControl(final Composite parent) { control = SWTUtil.createCompositeBothFill(parent, 1, false); @@ -65,33 +62,29 @@ public class SessionKindSelectionWizardPage extends WizardPage { emptyButton.addListener(SWT.Selection, new Listener() { + @Override public void handleEvent(final Event event) { final Button button = (Button) event.widget; emptyModel = button.getSelection(); } }); - emptyButton.setText("Empty file"); + emptyButton.setText(Messages.SessionKindSelectionWizardPage_emptyFile_label); final Label emptyLabel = new Label(control, SWT.NONE); - emptyLabel.setText(" Create a new empty representations file. You will be able after to associate this file with one or more semantic resources."); + emptyLabel.setText(" " + Messages.SessionKindSelectionWizardPage_emptyFile_details); //$NON-NLS-1$ new Label(control, SWT.NONE); new Label(control, SWT.NONE); final Button resourceButton = new Button(control, SWT.RADIO); - resourceButton.setText("Initialization from a semantic resource"); + resourceButton.setText(Messages.SessionKindSelectionWizardPage_initialization_label); resourceButton.setSelection(!emptyModel); final Label resourceLabel = new Label(control, SWT.NONE); - resourceLabel.setText(" Link the new representations file to a semantic resource. You will be able to associate this representations file with other semantic ressources."); + resourceLabel.setText(" " + Messages.SessionKindSelectionWizardPage_initialization_details); //$NON-NLS-1$ setControl(control); } - /** - * {@inheritDoc} - * - * @see org.eclipse.jface.wizard.WizardPage#getNextPage() - */ @Override public IWizardPage getNextPage() { if (!emptyModel) { @@ -103,7 +96,7 @@ public class SessionKindSelectionWizardPage extends WizardPage { /** * Return whether the selected session is an empty one. - * + * * @return <code>true</code> if the selected session is an empty one, * <code>false</code> otherwise */ diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionResourceCreationWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionResourceCreationWizardPage.java index 2c4670c067..0adc745e8d 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionResourceCreationWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/pages/SessionResourceCreationWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES 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 @@ -10,17 +10,20 @@ *******************************************************************************/ package org.eclipse.sirius.ui.tools.internal.wizards.pages; +import java.text.MessageFormat; + import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.emf.common.util.URI; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; /** * Wizard to create a new Session resource file. - * + * * @author mchauvin */ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage { @@ -31,7 +34,7 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage /** * Default Constructor to the wizard for session resource creation. - * + * * @param pageName * the page name. * @param selection @@ -49,7 +52,7 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage /** * Get the file extension. Override to create files with this extension. - * + * * @return the file extension */ protected String getExtension() { @@ -58,7 +61,7 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage /** * Get the URI. - * + * * @return the URI */ public URI getURI() { @@ -67,7 +70,7 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage /** * Get the file path. - * + * * @return the file path */ protected IPath getFilePath() { @@ -84,7 +87,7 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage /** * Get the default file name. - * + * * @return the default file name */ public String getDefaultFileName() { @@ -97,19 +100,13 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage /** * Get the default file name to use when there is no selected file. - * + * * @return the default file name to use when there is no selected file. */ protected String getNoselectionFileName() { - return "newDiagrams"; + return Messages.SessionResourceCreationWizardPage_noSelectionFileName; } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#createControl(org.eclipse.swt.widgets.Composite) - */ @Override public void createControl(final Composite parent) { super.createControl(parent); @@ -117,11 +114,6 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage setPageComplete(validatePage()); } - /** - * {@inheritDoc} - * - * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage() - */ @Override protected boolean validatePage() { boolean result = true; @@ -131,7 +123,7 @@ public class SessionResourceCreationWizardPage extends WizardNewFileCreationPage // Validate that entered extension is the expected one. final String extension = getExtension(); if (extension != null && !getFilePath().toString().endsWith("." + extension)) { //$NON-NLS-1$ - setErrorMessage("The file extension is wrong. It should be " + extension); + setErrorMessage(MessageFormat.format(Messages.SessionResourceCreationWizardPage_wrongFileExtension, extension)); result = false; } return result; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/viewpoint/provider/Messages.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/viewpoint/provider/Messages.java new file mode 100644 index 0000000000..06672f1602 --- /dev/null +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/viewpoint/provider/Messages.java @@ -0,0 +1,1016 @@ +/******************************************************************************* + * Copyright (c) 2015 Obeo. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.viewpoint.provider; + +import org.eclipse.sirius.ext.base.I18N; +import org.eclipse.sirius.ext.base.I18N.TranslatableMessage; + +/** + * Helper class to obtain translated strings. + * + * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a> + */ +public final class Messages { + static { + I18N.initializeMessages(Messages.class, SiriusEditPlugin.INSTANCE); + } + + // CHECKSTYLE:OFF + @TranslatableMessage + public static String AbstractCompositeEObjectPropertySource_missingEObject; + + @TranslatableMessage + public static String AbstractCompositeEObjectPropertySource_missingId; + + @TranslatableMessage + public static String AbstractCreateRepresentationFromRepresentationCreationDescription_creationError_message; + + @TranslatableMessage + public static String AbstractCreateRepresentationFromRepresentationCreationDescription_creationError_title; + + @TranslatableMessage + public static String AbstractCreateRepresentationFromRepresentationCreationDescription_defaultName; + + @TranslatableMessage + public static String AbstractDTreeEditor_eclipseWindowTitle; + + @TranslatableMessage + public static String AbstractDTreeEditor_modelerDescriptionFilesLoadedJob; + + @TranslatableMessage + public static String AbstractDTreeEditor_noSessionError; + + @TranslatableMessage + public static String AbstractExportRepresentationsAction_cancelled; + + @TranslatableMessage + public static String AbstractExportRepresentationsAction_error; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_accessError; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_blankFolderError; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_browseLabel; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_folderDoesNotExist; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_htmlExport; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_imageFormatLabel; + + @TranslatableMessage + public static String AbstractExportRepresentationsAsImagesDialog_invalidFolderPathError; + + @TranslatableMessage + public static String AbstractSWTCallback_askForDetailName_canceled; + + @TranslatableMessage + public static String AbstractSWTCallback_loadResourceError; + + @TranslatableMessage + public static String AbstractSWTCallback_models; + + @TranslatableMessage + public static String AbstractSWTCallback_modelsAndRepresentations; + + @TranslatableMessage + public static String AbstractSWTCallback_modelsAndRepresentationsInProject; + + @TranslatableMessage + public static String AbstractSWTCallback_modelsInProject; + + @TranslatableMessage + public static String AbstractSWTCallback_representations; + + @TranslatableMessage + public static String AbstractSWTCallback_representationsInProject; + + @TranslatableMessage + public static String AbstractSWTCallback_shouldClose_message; + + @TranslatableMessage + public static String AbstractSWTCallback_shouldClose_title; + + @TranslatableMessage + public static String AbstractSWTCallback_shouldReload_message; + + @TranslatableMessage + public static String AbstractSWTCallback_shouldReload_title; + + @TranslatableMessage + public static String AbstractSWTCallback_shouldRemove_message; + + @TranslatableMessage + public static String AbstractSWTCallback_shouldRemove_title; + + @TranslatableMessage + public static String AddModelDependencyAction_error; + + @TranslatableMessage + public static String AddModelDependencyAction_resourceSelectionMessage; + + @TranslatableMessage + public static String AddModelDependencyAction_title; + + @TranslatableMessage + public static String AddSemanticResourceAction_title; + + @TranslatableMessage + public static String ChangeViewpointSelectionCommand_activationError; + + @TranslatableMessage + public static String ChangeViewpointSelectionCommand_applySelectionTask; + + @TranslatableMessage + public static String ChangeViewpointSelectionCommand_deselectViewpointTask; + + @TranslatableMessage + public static String ChangeViewpointSelectionCommand_label; + + @TranslatableMessage + public static String ChangeViewpointSelectionCommand_selectViewpointTask; + + @TranslatableMessage + public static String CloseSessionsAction_error; + + @TranslatableMessage + public static String CloseUISessionCommand_closeRepresentationFileTask; + + @TranslatableMessage + public static String CloseUISessionCommand_closingError; + + @TranslatableMessage + public static String CloseUISessionCommand_saveDialogTitle; + + @TranslatableMessage + public static String CommonNavigatorTab_name; + + @TranslatableMessage + public static String ConfirmationDialogDeleteHook_dialogMessage; + + @TranslatableMessage + public static String ConfirmationDialogDeleteHook_dialogTitle; + + @TranslatableMessage + public static String ContextMenuFiller_closeSession; + + @TranslatableMessage + public static String ContextMenuFiller_move; + + @TranslatableMessage + public static String ContextMenuFiller_newRepresentation; + + @TranslatableMessage + public static String ContextMenuFiller_saveSession; + + @TranslatableMessage + public static String ContextMenuFiller_saveSessionError; + + @TranslatableMessage + public static String ContextMenuFiller_showInHierarchy; + + @TranslatableMessage + public static String CopyRepresentationAction_copyRepresentationDialog_title; + + @TranslatableMessage + public static String CopyRepresentationAction_copyRepresentationsDialog_defaultNewName; + + @TranslatableMessage + public static String CopyRepresentationAction_copyRepresentationsDialog_message; + + @TranslatableMessage + public static String CopyRepresentationAction_copyRepresentationsDialog_title; + + @TranslatableMessage + public static String CopyRepresentationAction_name; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_initialEObject; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_modelCreation; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_resourceAdditionError; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_resourceCreationError; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_resourceNotCreatedError; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_selectResourceMessage; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_windowTitle; + + @TranslatableMessage + public static String CreateOrAddResourceWizard_wizardTitle; + + @TranslatableMessage + public static String CreateOrAddResourceWizardPage_addResource_details; + + @TranslatableMessage + public static String CreateOrAddResourceWizardPage_addResource_label; + + @TranslatableMessage + public static String CreateOrAddResourceWizardPage_createResource_details; + + @TranslatableMessage + public static String CreateOrAddResourceWizardPage_createResource_label; + + @TranslatableMessage + public static String CreateOrAddResourceWizardPage_description; + + @TranslatableMessage + public static String CreateRepresentationAction_creationTask; + + @TranslatableMessage + public static String CreateRepresentationAction_openingTask; + + @TranslatableMessage + public static String CreateRepresentationFromSessionAction_name; + + @TranslatableMessage + public static String CreateRepresentationFromSessionAction_wizardTitle; + + @TranslatableMessage + public static String CreateRepresentationWizard_title; + + @TranslatableMessage + public static String CreateSessionResourceWizard_resourceCreationError; + + @TranslatableMessage + public static String CreateSessionResourceWizard_sessionDataCreationError; + + @TranslatableMessage + public static String CreateSessionResourceWizard_title; + + @TranslatableMessage + public static String DefaultDialectEditorDialogFactory_message; + + @TranslatableMessage + public static String DefaultDialectEditorDialogFactory_title; + + @TranslatableMessage + public static String DeleteRepresentationAction_closeEditorsTask; + + @TranslatableMessage + public static String DeleteRepresentationAction_deleteRepresentationTask; + + @TranslatableMessage + public static String DeleteRepresentationAction_deleteRepresentationTask_plural; + + @TranslatableMessage + public static String DeleteRepresentationAction_message; + + @TranslatableMessage + public static String DeleteRepresentationAction_message_plural; + + @TranslatableMessage + public static String DeleteRepresentationAction_name; + + @TranslatableMessage + public static String DeleteRepresentationAction_title; + + @TranslatableMessage + public static String DeleteRepresentationAction_title_plural; + + @TranslatableMessage + public static String DesignerControlAction_controlTask; + + @TranslatableMessage + public static String DesignerControlAction_saveDialogTitle; + + @TranslatableMessage + public static String DesignerControlAction_savingTask; + + @TranslatableMessage + public static String DesignerControlAction_uncontrolTask; + + @TranslatableMessage + public static String DesignerInterpreterView_addDependencyButton; + + @TranslatableMessage + public static String DesignerInterpreterView_addDependencyDialogMessage; + + @TranslatableMessage + public static String DesignerInterpreterView_addDependencyDialogTitle; + + @TranslatableMessage + public static String DesignerInterpreterView_copyToClipboardButton; + + @TranslatableMessage + public static String DesignerInterpreterView_copyToClipboardResult; + + @TranslatableMessage + public static String DesignerInterpreterView_evaluationResult; + + @TranslatableMessage + public static String DesignerInterpreterView_invalidExpressionError; + + @TranslatableMessage + public static String DesignerInterpreterView_requestsInterpreter; + + @TranslatableMessage + public static String DesignerInterpreterView_setButton; + + @TranslatableMessage + public static String DesignerInterpreterView_typeVariableName; + + @TranslatableMessage + public static String DesignerInterpreterView_unsetButton; + + @TranslatableMessage + public static String DesignerInterpreterView_variableName; + + @TranslatableMessage + public static String DesignerInterpreterView_variablesSection; + + @TranslatableMessage + public static String DTableLabelProvider_nbSelectedItems; + + @TranslatableMessage + public static String DTableLabelProvider_selectedItemsList; + + @TranslatableMessage + public static String EclipseUISessionFactoryDescriptor_extensionLoadingError; + + @TranslatableMessage + public static String EditorNameAdapter_representationClosingError; + + @TranslatableMessage + public static String ExportAction_defaultDiagramName; + + @TranslatableMessage + public static String ExportAction_exportDiagramsAsImagesCancelled; + + @TranslatableMessage + public static String ExportAction_exportDiagramsAsImagesTitle; + + @TranslatableMessage + public static String ExportAction_exportError; + + @TranslatableMessage + public static String ExportAction_exportImpossibleTitle; + + @TranslatableMessage + public static String ExportAction_imagesTooLargeMessage; + + @TranslatableMessage + public static String ExportAction_memAllocError; + + @TranslatableMessage + public static String ExportOneRepresentationAsImageDialog_dialogTitle; + + @TranslatableMessage + public static String ExportOneRepresentationAsImageDialog_exportToImage; + + @TranslatableMessage + public static String ExportOneRepresentationAsImageDialog_invalidFilePath; + + @TranslatableMessage + public static String ExportOneRepresentationAsImageDialog_invalidPath; + + @TranslatableMessage + public static String ExportOneRepresentationAsImageDialog_toFile; + + @TranslatableMessage + public static String ExportRepresentationsAction_label; + + @TranslatableMessage + public static String ExportRepresentationsAction_noRepresentationsDialog_message; + + @TranslatableMessage + public static String ExportRepresentationsAction_noRepresentationsDialog_title; + + @TranslatableMessage + public static String ExportRepresentationsFromFileAction_errorDialog_title; + + @TranslatableMessage + public static String ExportRepresentationsFromFileAction_exportTask; + + @TranslatableMessage + public static String ExportRepresentationsFromFileAction_interruptedDialog_title; + + @TranslatableMessage + public static String ExportRepresentationsFromFileAction_noRepresentationsDialog_message; + + @TranslatableMessage + public static String ExportRepresentationsFromFileAction_noRepresentationsDialog_title; + + @TranslatableMessage + public static String ExportSeveralRepresentationsAsImagesDialog_dialogMessage; + + @TranslatableMessage + public static String ExportSeveralRepresentationsAsImagesDialog_dialogTitle; + + @TranslatableMessage + public static String ExportSeveralRepresentationsAsImagesDialog_toDirectory; + + @TranslatableMessage + public static String ExtractRepresentationAction_dialogTitle; + + @TranslatableMessage + public static String ExtractRepresentationAction_label; + + @TranslatableMessage + public static String ExtractRepresentationsWizard_airdCreationError; + + @TranslatableMessage + public static String ExtractRepresentationsWizard_moveFailed; + + @TranslatableMessage + public static String ExtractRepresentationsWizard_moveInterrupted; + + @TranslatableMessage + public static String ExtractRepresentationsWizard_pageName; + + @TranslatableMessage + public static String ExtractRepresentationsWizard_resourceCreationError; + + @TranslatableMessage + public static String ExtractRepresentationsWizard_title; + + @TranslatableMessage + public static String FilteredCommonTree_missingFilter; + + @TranslatableMessage + public static String FilteredCommonTree_refreshFilterJob; + + @TranslatableMessage + public static String GenericInitialObjectPage_containerLabel; + + @TranslatableMessage + public static String GenericInitialObjectPage_encodingLabel; + + @TranslatableMessage + public static String GenericModelCreationPage_fileExtensionError; + + @TranslatableMessage + public static String LoadEMFResourceRunnableWithProgress_loadResourceTask; + + @TranslatableMessage + public static String LogThroughActiveDialectEditorLogListener_permissionError; + + @TranslatableMessage + public static String MarkerDeletionJob_name; + + @TranslatableMessage + public static String MenuHelper_anonymousRepresentation; + + @TranslatableMessage + public static String ModelingModelProvider_addAnotherRepresentationFile; + + @TranslatableMessage + public static String ModelingModelProvider_addAnotherRepresentationFileSeveralProjects; + + @TranslatableMessage + public static String ModelingModelProvider_mainRepresentationFileDeleted; + + @TranslatableMessage + public static String ModelingModelProvider_mainRepresentationFilesOfSomeProjectsDeleted; + + @TranslatableMessage + public static String ModelingModelProvider_satusUnsaveDataWillBeLostWithProjectNames; + + @TranslatableMessage + public static String ModelingModelProvider_satusUnsavedDataWillBeLost; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_addingModelingNatureTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_convertToModelingProjectTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_createModelingProjectTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_createProjectTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_createRepresentationFileTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_openProjectTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_removingModelingNatureTask; + + @TranslatableMessage + public static String ModelingProjectManagerImpl_semanticResourcesAdditionTask; + + @TranslatableMessage + public static String ModelingProjectWizard_title; + + @TranslatableMessage + public static String ModelingToggleNatureAction_errorDialogMessage; + + @TranslatableMessage + public static String ModelingToggleNatureAction_errorDialogTitle; + + @TranslatableMessage + public static String MoveRepresentationAction_text; + + @TranslatableMessage + public static String NavigateToCommand_name; + + @TranslatableMessage + public static String NewSessionWizard_fileCreationTask; + + @TranslatableMessage + public static String NewSessionWizard_representationFileCreationError; + + @TranslatableMessage + public static String NewSessionWizard_selectModel; + + @TranslatableMessage + public static String NewSessionWizard_title; + + @TranslatableMessage + public static String OpenCloseSessionActionProvider_openCloseAction_close; + + @TranslatableMessage + public static String OpenCloseSessionActionProvider_openCloseAction_open; + + @TranslatableMessage + public static String OpenCloseSessionActionProvider_openWithMenu; + + @TranslatableMessage + public static String OpenRepresentationsAction_name; + + @TranslatableMessage + public static String OpenRepresentationsAction_openRepresentationsTask; + + @TranslatableMessage + public static String OpenRepresentationsAction_openRepresentationTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_errorInvalidInputList; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_initModelingProjectsTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_invalidModelingProjectsError; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_label; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadingModelsTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadingProblem_defaultErrorDetail; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadingProblem_modelingProject; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadingProblem_representationFile; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadingRepresentationFileTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadReferencedModelsTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_loadRepresentationsTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_openingStartRepresentationTask; + + @TranslatableMessage + public static String OpenRepresentationsFileJob_unexpectedException; + + @TranslatableMessage + public static String OpenSessionOnExpandListener_expandJob; + + @TranslatableMessage + public static String OpenViewpointSelectionAction_name; + + @TranslatableMessage + public static String ProjectDependenciesItemImpl_text; + + @TranslatableMessage + public static String RefreshLabelImageJob_name; + + @TranslatableMessage + public static String RemoveRepresentationResourceAction_name; + + @TranslatableMessage + public static String RemoveRepresentationResourceAction_saveDialogTitle; + + @TranslatableMessage + public static String RemoveSemanticResourceAction_name; + + @TranslatableMessage + public static String RenameRepresentationAction_name; + + @TranslatableMessage + public static String RepresentationFilesRepairAction_repairError; + + @TranslatableMessage + public static String RepresentationFilesRepairAction_repairFailed; + + @TranslatableMessage + public static String RepresentationFilesRepairAction_repairInterrupted; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_askContinue; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_askSave; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_confirmationDialogTitle; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_launchImpossibleRepresentationsOpened; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_migrationCanceled; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_repairActionLabel; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_representationFileModified; + + @TranslatableMessage + public static String RepresentationFilesRepairValidator_representationFilesModified; + + @TranslatableMessage + public static String RepresentationSelectionWizardPage_errorReadonlyContainer; + + @TranslatableMessage + public static String RepresentationSelectionWizardPage_message; + + @TranslatableMessage + public static String RepresentationSelectionWizardPage_title; + + @TranslatableMessage + public static String RepresentationsSelectionDialog_shellTitle; + + @TranslatableMessage + public static String RepresentationsSelectionWizardPage_message; + + @TranslatableMessage + public static String RepresentationsSelectionWizardPage_pageTitle; + + @TranslatableMessage + public static String RepresentationsSelectionWizardPage_readOnlyContainerError; + + @TranslatableMessage + public static String RepresentationsSelectionWizardPage_unknownCodeError; + + @TranslatableMessage + public static String ResourcesFolderItemImpl_text; + + @TranslatableMessage + public static String RestoreToLastSavePointListener_errorModifiedResourcesReloaded; + + @TranslatableMessage + public static String SelectAnalysisFilePage_browseButton; + + @TranslatableMessage + public static String SelectAnalysisFilePage_defaultFileName; + + @TranslatableMessage + public static String SelectAnalysisFilePage_description; + + @TranslatableMessage + public static String SelectAnalysisFilePage_existingFileGroup; + + @TranslatableMessage + public static String SelectAnalysisFilePage_existingFileGroup_button; + + @TranslatableMessage + public static String SelectAnalysisFilePage_folderExportGroup; + + @TranslatableMessage + public static String SelectAnalysisFilePage_folderExportGroup_button; + + @TranslatableMessage + public static String SelectAnalysisFilePage_folderSelectionDialogTitle; + + @TranslatableMessage + public static String SelectAnalysisFilePage_newFileGroup; + + @TranslatableMessage + public static String SelectAnalysisFilePage_newFileGroup_button; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_browseButton; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_description; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_noMetamodelType; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_registryLabel; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_statusNoURI; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_statusUnknownURI; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_typeValues; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_uriLabel; + + @TranslatableMessage + public static String SelectMetamodelWizardPage_workspaceDialogTitle; + + @TranslatableMessage + public static String SelectRepresentationsWizard_title; + + @TranslatableMessage + public static String SemanticElementSelectionWizardPage_message; + + @TranslatableMessage + public static String SemanticElementSelectionWizardPage_title; + + @TranslatableMessage + public static String SemanticResourceAdditionOperation_semanticResourceAdditionTask; + + @TranslatableMessage + public static String SemanticResourceDialog_representationFilesCantBeAdded_message; + + @TranslatableMessage + public static String SemanticResourceDialog_representationFilesCantBeAdded_status; + + @TranslatableMessage + public static String SemanticResourceDialog_representationFilesCantBeAdded_title; + + @TranslatableMessage + public static String SessionEditorInput_defaultEditorName; + + @TranslatableMessage + public static String SessionFileCreationWizardPage_description; + + @TranslatableMessage + public static String SessionFileCreationWizardPage_errorMessage; + + @TranslatableMessage + public static String SessionFileCreationWizardPage_noSelectionFileName; + + @TranslatableMessage + public static String SessionFileCreationWizardPage_title; + + @TranslatableMessage + public static String SessionHelper_openStartupRepresentationsTask; + + @TranslatableMessage + public static String SessionHelper_origin; + + @TranslatableMessage + public static String SessionHelper_selectionDialogMessage; + + @TranslatableMessage + public static String SessionHelper_selectionDialogMessageWithOrigin; + + @TranslatableMessage + public static String SessionHelper_selectionDialogTitle; + + @TranslatableMessage + public static String SessionHelper_startupRepresentationOpeningTask; + + @TranslatableMessage + public static String SessionKindSelectionWizardPage_description; + + @TranslatableMessage + public static String SessionKindSelectionWizardPage_emptyFile_details; + + @TranslatableMessage + public static String SessionKindSelectionWizardPage_emptyFile_label; + + @TranslatableMessage + public static String SessionKindSelectionWizardPage_initialization_details; + + @TranslatableMessage + public static String SessionKindSelectionWizardPage_initialization_label; + + @TranslatableMessage + public static String SessionKindSelectionWizardPage_title; + + @TranslatableMessage + public static String SessionLabelProvider_errorReadingModel; + + @TranslatableMessage + public static String SessionResourceCreationWizardPage_noSelectionFileName; + + @TranslatableMessage + public static String SessionResourceCreationWizardPage_wrongFileExtension; + + @TranslatableMessage + public static String SessionSpecificEditorInput_transformationFailure; + + @TranslatableMessage + public static String SiriusCellEditorProviderCollector_contributionInstantiationError; + + @TranslatableMessage + public static String SiriusCommonContentProvider_asyncUpdateJob; + + @TranslatableMessage + public static String SiriusCommonLabelProvider_eClassDisabled; + + @TranslatableMessage + public static String SiriusControlHandler_controlTask; + + @TranslatableMessage + public static String SiriusPreferencePage_autoRefresh; + + @TranslatableMessage + public static String SiriusPreferencePage_defensiveEditValidation; + + @TranslatableMessage + public static String SiriusPreferencePage_emptyAirdOnControl; + + @TranslatableMessage + public static String SiriusPreferencePage_emptyAirdOnControl_help; + + @TranslatableMessage + public static String SiriusPreferencePage_enableGrouping; + + @TranslatableMessage + public static String SiriusPreferencePage_enableGrouping_help; + + @TranslatableMessage + public static String SiriusPreferencePage_filesGroup; + + @TranslatableMessage + public static String SiriusPreferencePage_groupingGroup; + + @TranslatableMessage + public static String SiriusPreferencePage_groupingGroupSize; + + @TranslatableMessage + public static String SiriusPreferencePage_groupingGroupSize_help; + + @TranslatableMessage + public static String SiriusPreferencePage_groupingTheshold; + + @TranslatableMessage + public static String SiriusPreferencePage_groupingTheshold_help; + + @TranslatableMessage + public static String SiriusPreferencePage_profilerGroup; + + @TranslatableMessage + public static String SiriusPreferencePage_profiling; + + @TranslatableMessage + public static String SiriusPreferencePage_profiling_help; + + @TranslatableMessage + public static String SiriusPreferencePage_refreshGroup; + + @TranslatableMessage + public static String SiriusPreferencePage_refreshOnRepresentationOpening; + + @TranslatableMessage + public static String SiriusUncontrolHandler_uncontrolRepresentationsMessage; + + @TranslatableMessage + public static String SiriusUncontrolHandler_uncontrolRepresentationsTitle; + + @TranslatableMessage + public static String SiriusUncontrolHandler_uncontrolTask; + + @TranslatableMessage + public static String SmartDialogAnalysisSelector_message; + + @TranslatableMessage + public static String SmartDialogAnalysisSelector_title; + + @TranslatableMessage + public static String SpecificEditorInputTranformer_defaultFileName; + + @TranslatableMessage + public static String SpecificEditorInputTranformer_newRepresentationName; + + @TranslatableMessage + public static String SpecificEditorInputTranformer_transformationFailure; + + @TranslatableMessage + public static String TraceabilityMarkerNavigationProvider_dialogMessage; + + @TranslatableMessage + public static String TraceabilityMarkerNavigationProvider_dialogTitle; + + @TranslatableMessage + public static String TraceabilityMarkerNavigationProvider_noSessionFoundError; + + @TranslatableMessage + public static String TreeEditorDialogFactory_error; + + @TranslatableMessage + public static String UserSession_openRepresentationTask; + + @TranslatableMessage + public static String UserSession_representationNotFound; + + @TranslatableMessage + public static String UserSession_viewpointSelectionFailed; + + @TranslatableMessage + public static String ViewpointItemImpl_notFoundLabel; + + @TranslatableMessage + public static String ViewpointSelection_applySelectionTask; + + @TranslatableMessage + public static String ViewpointSelection_loadingViewpointsTask; + + @TranslatableMessage + public static String ViewpointSelection_missingDependencies_header; + + @TranslatableMessage + public static String ViewpointSelection_missingDependencies_requirements; + + @TranslatableMessage + public static String ViewpointSelection_iconColumn; + + @TranslatableMessage + public static String ViewpointSelection_viewpointColumn; + + @TranslatableMessage + public static String ViewpointSelection_viewpointsMapNotReused; + + @TranslatableMessage + public static String ViewpointSelection_wizardTitle; + + @TranslatableMessage + public static String ViewpointSelectionCallback_deselection; + + @TranslatableMessage + public static String ViewpointSelectionCallback_selection; + + @TranslatableMessage + public static String ViewpointSelectionCallbackWithConfimation_viewpointUsedInOpenEditors_message; + + @TranslatableMessage + public static String ViewpointSelectionCallbackWithConfimation_viewpointUsedInOpenEditors_title; + + @TranslatableMessage + public static String ViewpointSelectionDialog_description; + + @TranslatableMessage + public static String ViewpointSelectionDialog_dialogTitle; + + @TranslatableMessage + public static String ViewpointSelectionDialog_message; + + @TranslatableMessage + public static String ViewpointSelectionDialog_selectionMessage; + + @TranslatableMessage + public static String ViewpointSelectionDialog_text; + + @TranslatableMessage + public static String ViewpointSelectionDialog_title; + + @TranslatableMessage + public static String ViewpointsFolderItemImpl_representationsPerCategory_title; + + @TranslatableMessage + public static String ViewpointsSelectionWizardPage_documentation_none; + + @TranslatableMessage + public static String ViewpointsSelectionWizardPage_documentation_title; + + @TranslatableMessage + public static String ViewpointsSelectionWizardPage_message; + + @TranslatableMessage + public static String ViewpointsSelectionWizardPage_title; + + // CHECKSTYLE:ON + + private Messages() { + // Prevents instanciation. + } +} |
