|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2010, 2012 IBM Corporation and others. |
2 |
* Copyright (c) 2010, 2014 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 10-23
Link Here
|
| 10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.pde.internal.ui.editor.feature; |
11 |
package org.eclipse.pde.internal.ui.editor.feature; |
| 12 |
|
12 |
|
| 13 |
import org.eclipse.pde.internal.core.ifeature.IFeatureModel; |
|
|
| 14 |
|
| 15 |
import java.util.ArrayList; |
13 |
import java.util.ArrayList; |
| 16 |
import org.eclipse.core.runtime.CoreException; |
14 |
import org.eclipse.core.runtime.CoreException; |
| 17 |
import org.eclipse.jface.resource.JFaceResources; |
15 |
import org.eclipse.jface.resource.JFaceResources; |
| 18 |
import org.eclipse.jface.text.*; |
16 |
import org.eclipse.jface.text.*; |
| 19 |
import org.eclipse.jface.text.source.SourceViewer; |
17 |
import org.eclipse.jface.text.source.SourceViewer; |
| 20 |
import org.eclipse.jface.text.source.SourceViewerConfiguration; |
18 |
import org.eclipse.jface.text.source.SourceViewerConfiguration; |
|
|
19 |
import org.eclipse.jface.viewers.*; |
| 21 |
import org.eclipse.jface.window.Window; |
20 |
import org.eclipse.jface.window.Window; |
| 22 |
import org.eclipse.pde.core.IEditable; |
21 |
import org.eclipse.pde.core.IEditable; |
| 23 |
import org.eclipse.pde.internal.core.PDECore; |
22 |
import org.eclipse.pde.internal.core.PDECore; |
|
Lines 29-38
Link Here
|
| 29 |
import org.eclipse.pde.internal.ui.editor.text.XMLConfiguration; |
28 |
import org.eclipse.pde.internal.ui.editor.text.XMLConfiguration; |
| 30 |
import org.eclipse.swt.SWT; |
29 |
import org.eclipse.swt.SWT; |
| 31 |
import org.eclipse.swt.custom.*; |
30 |
import org.eclipse.swt.custom.*; |
|
|
31 |
import org.eclipse.swt.dnd.Clipboard; |
| 32 |
import org.eclipse.swt.events.*; |
32 |
import org.eclipse.swt.events.*; |
| 33 |
import org.eclipse.swt.layout.GridData; |
33 |
import org.eclipse.swt.layout.GridData; |
| 34 |
import org.eclipse.swt.layout.GridLayout; |
34 |
import org.eclipse.swt.layout.GridLayout; |
| 35 |
import org.eclipse.swt.widgets.*; |
35 |
import org.eclipse.swt.widgets.*; |
|
|
36 |
import org.eclipse.ui.actions.ActionFactory; |
| 36 |
import org.eclipse.ui.forms.IFormColors; |
37 |
import org.eclipse.ui.forms.IFormColors; |
| 37 |
import org.eclipse.ui.forms.widgets.*; |
38 |
import org.eclipse.ui.forms.widgets.*; |
| 38 |
|
39 |
|
|
Lines 175-180
Link Here
|
| 175 |
fSourceViewer = new SourceViewer(localLicenseComposite, null, styles); |
176 |
fSourceViewer = new SourceViewer(localLicenseComposite, null, styles); |
| 176 |
fSourceViewer.configure(fSourceConfiguration); |
177 |
fSourceViewer.configure(fSourceConfiguration); |
| 177 |
fSourceViewer.setDocument(fDocument); |
178 |
fSourceViewer.setDocument(fDocument); |
|
|
179 |
fSourceViewer.addSelectionChangedListener(new ISelectionChangedListener() { |
| 180 |
public void selectionChanged(SelectionChangedEvent event) { |
| 181 |
updateSelection(event.getSelection()); |
| 182 |
} |
| 183 |
}); |
| 178 |
StyledText styledText = fSourceViewer.getTextWidget(); |
184 |
StyledText styledText = fSourceViewer.getTextWidget(); |
| 179 |
styledText.setFont(JFaceResources.getTextFont()); |
185 |
styledText.setFont(JFaceResources.getTextFont()); |
| 180 |
styledText.setMenu(getPage().getPDEEditor().getContextMenu()); |
186 |
styledText.setMenu(getPage().getPDEEditor().getContextMenu()); |
|
Lines 330-333
Link Here
|
| 330 |
} |
336 |
} |
| 331 |
super.commit(onSave); |
337 |
super.commit(onSave); |
| 332 |
} |
338 |
} |
|
|
339 |
|
| 340 |
public boolean doGlobalAction(String actionId) { |
| 341 |
if (actionId.equals(ActionFactory.CUT.getId())) { |
| 342 |
fSourceViewer.doOperation(ITextOperationTarget.CUT); |
| 343 |
return true; |
| 344 |
} else if (actionId.equals(ActionFactory.COPY.getId())) { |
| 345 |
fSourceViewer.doOperation(ITextOperationTarget.COPY); |
| 346 |
return true; |
| 347 |
} else if (actionId.equals(ActionFactory.PASTE.getId())) { |
| 348 |
fSourceViewer.doOperation(ITextOperationTarget.PASTE); |
| 349 |
return true; |
| 350 |
} else if (actionId.equals(ActionFactory.DELETE.getId())) { |
| 351 |
fSourceViewer.doOperation(ITextOperationTarget.DELETE); |
| 352 |
return true; |
| 353 |
} else if (actionId.equals(ActionFactory.UNDO.getId())) { |
| 354 |
fSourceViewer.doOperation(ITextOperationTarget.UNDO); |
| 355 |
return true; |
| 356 |
} else if (actionId.equals(ActionFactory.REDO.getId())) { |
| 357 |
fSourceViewer.doOperation(ITextOperationTarget.REDO); |
| 358 |
return true; |
| 359 |
} else if (actionId.equals(ActionFactory.SELECT_ALL.getId())) { |
| 360 |
fSourceViewer.doOperation(ITextOperationTarget.SELECT_ALL); |
| 361 |
} |
| 362 |
return false; |
| 363 |
} |
| 364 |
|
| 365 |
public boolean canPaste(Clipboard clipboard) { |
| 366 |
return fSourceViewer.canDoOperation(ITextOperationTarget.PASTE); |
| 367 |
} |
| 368 |
|
| 369 |
private void updateSelection(ISelection selection) { |
| 370 |
getPage().getPDEEditor().setSelection(selection); |
| 371 |
} |
| 333 |
} |
372 |
} |