View | Details | Raw Unified | Return to bug 426431 | Differences between
and this patch

Collapse All | Expand All

(-)a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/business/internal/dialect/DiagramDialectUIServices.java (-2 / +11 lines)
Lines 181-187 public class DiagramDialectUIServices implements DialectUIServices { Link Here
181
        return result;
181
        return result;
182
    }
182
    }
183
183
184
    private DialectEditor openEditor(Session session, Diagram gmfDiag, DRepresentation dRepresentation, IProgressMonitor monitor) {
184
    private DialectEditor openEditor(final Session session, Diagram gmfDiag, final DRepresentation dRepresentation, IProgressMonitor monitor) {
185
        DialectEditor dialectEditor = null;
185
        DialectEditor dialectEditor = null;
186
        URI uri = EcoreUtil.getURI(gmfDiag);
186
        URI uri = EcoreUtil.getURI(gmfDiag);
187
        String editorName = DialectUIManager.INSTANCE.getEditorName(dRepresentation);
187
        String editorName = DialectUIManager.INSTANCE.getEditorName(dRepresentation);
Lines 193-199 public class DiagramDialectUIServices implements DialectUIServices { Link Here
193
            public void run() {
193
            public void run() {
194
                final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
194
                final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
195
                try {
195
                try {
196
                    IEditorPart editorPart = page.openEditor(editorInput, DDiagramEditor.EDITOR_ID);
196
                    IEditorPart editorPart = page.openEditor(editorInput, getEditorID(dRepresentation));
197
                    if (editorPart instanceof DialectEditor) {
197
                    if (editorPart instanceof DialectEditor) {
198
                        setResult((DialectEditor) editorPart);
198
                        setResult((DialectEditor) editorPart);
199
                    }
199
                    }
Lines 269-274 public class DiagramDialectUIServices implements DialectUIServices { Link Here
269
    /**
269
    /**
270
     * {@inheritDoc}
270
     * {@inheritDoc}
271
     * 
271
     * 
272
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getEditorID(org.eclipse.sirius.viewpoint.DRepresentation)
273
     */
274
    public String getEditorID(DRepresentation dRepresentation) {
275
        return DDiagramEditor.EDITOR_ID;
276
    }
277
    
278
    /**
279
     * {@inheritDoc}
280
     * 
272
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#canHandleEditor(org.eclipse.ui.IEditorPart)
281
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#canHandleEditor(org.eclipse.ui.IEditorPart)
273
     */
282
     */
274
    public boolean canHandleEditor(final IEditorPart editorPart) {
283
    public boolean canHandleEditor(final IEditorPart editorPart) {
(-)a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/business/internal/dialect/TableDialectUIServices.java (-8 / +23 lines)
Lines 91-104 public class TableDialectUIServices implements DialectUIServices { Link Here
91
                monitor.worked(2);
91
                monitor.worked(2);
92
                final IEditorInput editorInput = new SessionEditorInput(uri, editorName, session);
92
                final IEditorInput editorInput = new SessionEditorInput(uri, editorName, session);
93
93
94
                final String editorId;
94
                final String editorId = getEditorID(dRepresentation);
95
                if (dTable.getDescription() instanceof EditionTableDescription) {
96
                    editorId = DTableEditionEditor.ID;
97
                } else if (dTable.getDescription() instanceof CrossTableDescription) {
98
                    editorId = DTableCrossEditor.ID;
99
                } else {
100
                    editorId = null;
101
                }
102
                if (editorId != null) {
95
                if (editorId != null) {
103
                    monitor.subTask("table opening : " + dRepresentation.getName());
96
                    monitor.subTask("table opening : " + dRepresentation.getName());
104
                    RunnableWithResult<IEditorPart> runnable = new RunnableWithResult.Impl<IEditorPart>() {
97
                    RunnableWithResult<IEditorPart> runnable = new RunnableWithResult.Impl<IEditorPart>() {
Lines 127-132 public class TableDialectUIServices implements DialectUIServices { Link Here
127
    }
120
    }
128
121
129
    /**
122
    /**
123
     *  {@inheritDoc}
124
     *  
125
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getEditorID(org.eclipse.sirius.viewpoint.DRepresentation)
126
     */
127
    public String getEditorID(DRepresentation dRepresentation) {
128
        final String editorId;
129
        if (dRepresentation instanceof DTable) {
130
            DTable dTable = (DTable) dRepresentation;
131
            if (dTable.getDescription() instanceof EditionTableDescription) {
132
                editorId = DTableEditionEditor.ID;
133
            } else if (dTable.getDescription() instanceof CrossTableDescription) {
134
                editorId = DTableCrossEditor.ID;
135
            } else {
136
                editorId = null;
137
            }
138
        } else {
139
            editorId = null;
140
        }
141
        return editorId;
142
    }
143
    
144
    /**
130
     * 
145
     * 
131
     * {@inheritDoc}
146
     * {@inheritDoc}
132
     */
147
     */
(-)a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/business/internal/dialect/TreeDialectUIServices.java (-2 / +11 lines)
Lines 88-94 public class TreeDialectUIServices implements DialectUIServices { Link Here
88
    /**
88
    /**
89
     * {@inheritDoc}
89
     * {@inheritDoc}
90
     */
90
     */
91
    public IEditorPart openEditor(Session session, DRepresentation dRepresentation, IProgressMonitor monitor) {
91
    public IEditorPart openEditor(final Session session, final DRepresentation dRepresentation, IProgressMonitor monitor) {
92
        IEditorPart editorPart = null;
92
        IEditorPart editorPart = null;
93
        try {
93
        try {
94
            monitor.beginTask("tree opening", 10);
94
            monitor.beginTask("tree opening", 10);
Lines 102-108 public class TreeDialectUIServices implements DialectUIServices { Link Here
102
                    public void run() {
102
                    public void run() {
103
                        final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
103
                        final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
104
                        try {
104
                        try {
105
                            setResult(page.openEditor(editorInput, DTreeEditor.ID));
105
                            setResult(page.openEditor(editorInput, getEditorID(dRepresentation)));
106
                        } catch (final PartInitException e) {
106
                        } catch (final PartInitException e) {
107
                            // silent catch
107
                            // silent catch
108
                        }
108
                        }
Lines 125-130 public class TreeDialectUIServices implements DialectUIServices { Link Here
125
    /**
125
    /**
126
     * {@inheritDoc}
126
     * {@inheritDoc}
127
     * 
127
     * 
128
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getEditorID(org.eclipse.sirius.viewpoint.DRepresentation)
129
     */
130
    public String getEditorID(DRepresentation dRepresentation) {
131
        return DTreeEditor.ID;
132
    }
133
    
134
    /**
135
     * {@inheritDoc}
136
     * 
128
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getEditorName(org.eclipse.sirius.viewpoint.DRepresentation)
137
     * @see org.eclipse.sirius.ui.business.api.dialect.DialectUIServices#getEditorName(org.eclipse.sirius.viewpoint.DRepresentation)
129
     */
138
     */
130
    public String getEditorName(DRepresentation representation) {
139
    public String getEditorName(DRepresentation representation) {
(-)a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/dialect/DialectUIServices.java (+9 lines)
Lines 100-105 public interface DialectUIServices { Link Here
100
    IEditorPart openEditor(Session session, DRepresentation dRepresentation, IProgressMonitor monitor);
100
    IEditorPart openEditor(Session session, DRepresentation dRepresentation, IProgressMonitor monitor);
101
101
102
    /**
102
    /**
103
     * Gets the editor ID for the given representation.
104
     * @param dRepresentation
105
     *            {@link DRepresentation} to open.
106
     * 
107
     * @return the editor ID for the given representation if any, <code>null</code> otherwise.
108
     */
109
    String getEditorID(DRepresentation dRepresentation);
110
    
111
    /**
103
     * Sets the given {@link DRepresentationElement}s as current selection for
112
     * Sets the given {@link DRepresentationElement}s as current selection for
104
     * the editor.
113
     * the editor.
105
     * 
114
     * 
(-)a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/dialect/DialectUIManagerImpl.java (+13 lines)
Lines 99-104 public class DialectUIManagerImpl implements DialectUIManager { Link Here
99
     * 
99
     * 
100
     * {@inheritDoc}
100
     * {@inheritDoc}
101
     */
101
     */
102
    public String getEditorID(DRepresentation dRepresentation) {
103
        for (final DialectUI dialect : dialects.values()) {
104
            if (dialect.getServices().canHandle(dRepresentation)) {
105
                return dialect.getServices().getEditorID(dRepresentation);
106
            }
107
        }
108
        return null;
109
    }
110
    
111
    /**
112
     * 
113
     * {@inheritDoc}
114
     */
102
    public Collection<CommandParameter> provideNewChildDescriptors() {
115
    public Collection<CommandParameter> provideNewChildDescriptors() {
103
        final Collection<CommandParameter> result = new ArrayList<CommandParameter>();
116
        final Collection<CommandParameter> result = new ArrayList<CommandParameter>();
104
        for (final DialectUI dialect : dialects.values()) {
117
        for (final DialectUI dialect : dialects.values()) {

Return to bug 426431