下面列出了org.eclipse.ui.IWorkbenchPartConstants#org.eclipse.ui.IPropertyListener 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* {@inheritDoc}
*/
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{
updateItem(newPart);
newPart.addPropertyListener(new IPropertyListener()
{
public void propertyChanged(Object source, int propId)
{
updateItem(newPart);
}
});
resizeSelectedPart();
}
/**
* {@inheritDoc}
*/
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{
ignoreSelection = true;
final CTabItem item = new CTabItem(tabFolder,SWT.NONE);
ignoreSelection = false;
item.setData(DATAKEY_PART,newPart);
updateItem(newPart);
newPart.addPropertyListener(new IPropertyListener()
{
public void propertyChanged(Object source, int propId)
{
updateItem(newPart);
}
});
}
/**
* {@inheritDoc}
*/
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{
updateItem(newPart);
newPart.addPropertyListener(new IPropertyListener()
{
public void propertyChanged(Object source, int propId)
{
updateItem(newPart);
}
});
resizeSelectedPart();
}
@Override
protected void createTypeSpecificEditors(Composite parent) {
try {
IJavaBreakpoint breakpoint = getBreakpoint();
IMarker marker = breakpoint.getMarker();
Object sourceUri = marker.getAttribute(StratumBreakpointAdapterFactory.ORG_ECLIPSE_XTEXT_XBASE_SOURCE_URI);
if (sourceUri != null) {
setTitle("Condition");
final JavaBreakpointConditionEditor editor = new JavaBreakpointConditionEditor();
editor.createControl(parent);
editor.addPropertyListener(new IPropertyListener() {
@Override
public void propertyChanged(Object source, int propId) {
IStatus status = editor.getStatus();
if (status.isOK()) {
if (fPrevMessage != null) {
removeErrorMessage(fPrevMessage);
fPrevMessage = null;
}
} else {
fPrevMessage = status.getMessage();
addErrorMessage(fPrevMessage);
}
}
});
URI uri = URI.createURI(String.valueOf(sourceUri));
JavaBreakPointProvider breakPointProvider = registry.getResourceServiceProvider(uri).get(JavaBreakPointProvider.class);
editor.setInput(breakPointProvider.getBreakpointWithJavaLocation((IJavaStratumLineBreakpoint) breakpoint));
// set this editor only if it was correctly initialized
this.editor = editor;
}
} catch (CoreException e) {
setErrorMessage(e.getMessage());
}
}
/**
* This was the body of the <code>execute</code>, but was pulled out so it could be
* used in other places to open a module.
*
* @param moduleName
*/
public static void openModule(String moduleName) {
if (moduleName == null)
{
throw new RuntimeException("Module was null" );
}
Spec spec = Activator.getSpecManager().getSpecLoaded();
final IFile module = ResourceHelper.getLinkedFile(spec.getProject(), ResourceHelper.getModuleFileName(moduleName));
if (module == null)
{
throw new RuntimeException("Module " + moduleName + " could not be found" );
}
// open the editor
IEditorPart part = UIHelper.openEditor(OpenSpecHandler.TLA_EDITOR, new FileEditorInput(module));
part.addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propId)
{
if (IWorkbenchPartConstants.PROP_DIRTY == propId)
{
// here the listeners to editor changes go into
}
}
});
}
public void addPropertyListener(IPropertyListener l) {
if (tagStyleManager != null) {
tagStyleManager.setTagStyle(TagStyle.curStyle);
autoResize();
refresh();
}
super.addPropertyListener(l);
}
public void addPropertyListener(IPropertyListener l) {
if (tagStyleManager != null) {
tagStyleManager.setTagStyle(TagStyle.curStyle);
autoResize();
refresh();
}
super.addPropertyListener(l);
}
/**
* {@inheritDoc}
*/
@Override
public void addPart(final IPresentablePart newPart, Object cookie)
{
ignoreSelection = true;
final PShelfItem item = new PShelfItem(shelf,SWT.NONE);
ignoreSelection = false;
item.setData(DATAKEY_PART,newPart);
item.getBody().setLayout(null);
item.getBody().addListener(SWT.Paint, new Listener()
{
public void handleEvent(Event e)
{
Integer separatorY = (Integer)item.getBody().getData(DATAKEY_SEPHEIGHT);
if (separatorY == null) return;
e.gc.setForeground(border);
e.gc.drawLine(0,separatorY.intValue(),item.getBody().getSize().x,separatorY.intValue());
}
});
CLabel descLabel = new CLabel(item.getBody(),SWT.WRAP);
item.setData(DATAKEY_DESCLABEL,descLabel);
descLabel.setBackground(toolbarBackground);
ToolBar tb = new ToolBar(item.getBody(),SWT.NONE);
item.setData(DATAKEY_MENUTOOL,tb);
tb.setBackground(toolbarBackground);
updateItem(newPart);
newPart.addPropertyListener(new IPropertyListener()
{
public void propertyChanged(Object source, int propId)
{
updateItem(newPart);
}
});
}
public void removePropertyListener(IPropertyListener listener) {
}
public void removePropertyListener(IPropertyListener listener) {
}
public void removePropertyListener(IPropertyListener listener) {
}
public void removePropertyListener(IPropertyListener listener) {
}
public void removePropertyListener(IPropertyListener listener) {
}
@Override
public void run() {
IPath ignoreThrownExceptionsPath = PyExceptionBreakPointManager
.getInstance().ignoreCaughtExceptionsWhenThrownFrom
.getIgnoreThrownExceptionsPath();
File file = ignoreThrownExceptionsPath.toFile();
IEditorPart openFile = EditorUtils.openFile(file);
if (openFile instanceof ITextEditor) {
final ITextEditor textEditor = (ITextEditor) openFile;
IDocumentProvider documentProvider = textEditor.getDocumentProvider();
final IEditorInput input = openFile.getEditorInput();
if (documentProvider instanceof IStorageDocumentProvider) {
IStorageDocumentProvider storageDocumentProvider = (IStorageDocumentProvider) documentProvider;
// Make sure the file is seen as UTF-8.
storageDocumentProvider.setEncoding(input, "utf-8");
textEditor.doRevertToSaved();
}
if (textEditor instanceof ISaveablePart) {
IPropertyListener listener = new IPropertyListener() {
@Override
public void propertyChanged(Object source, int propId) {
if (propId == IWorkbenchPartConstants.PROP_DIRTY) {
if (source == textEditor) {
if (textEditor.getEditorInput() == input) {
if (!textEditor.isDirty()) {
PyExceptionBreakPointManager.getInstance().ignoreCaughtExceptionsWhenThrownFrom
.updateIgnoreThrownExceptions();
}
}
}
}
}
};
textEditor.addPropertyListener(listener);
}
}
// Code to provide a dialog to edit it (decided on opening the file instead).
// Collection<IgnoredExceptionInfo> ignoreThrownExceptionsForEdition = PyExceptionBreakPointManager.getInstance()
// .getIgnoreThrownExceptionsForEdition();
// HashMap<String, String> map = new HashMap<>();
// for (IgnoredExceptionInfo ignoredExceptionInfo : ignoreThrownExceptionsForEdition) {
// map.put(ignoredExceptionInfo.filename + ": " + ignoredExceptionInfo.line, ignoredExceptionInfo.contents);
// }
//
// EditIgnoredCaughtExceptionsDialog dialog = new EditIgnoredCaughtExceptionsDialog(EditorUtils.getShell(), map);
// int open = dialog.open();
// if (open == dialog.OK) {
// Map<String, String> result = dialog.getResult();
//
// } else {
// System.out.println("Cancel");
// }
}
public void addPropertyListener(IPropertyListener listener) {
}
public void addPropertyListener(IPropertyListener listener) {
}
public void addPropertyListener(IPropertyListener listener) {
}
public void addPropertyListener(IPropertyListener listener) {
}
public void addPropertyListener(IPropertyListener listener) {
}
public void addPropertyListener(IPropertyListener listener) {
// TODO Auto-generated method stub
}
public void removePropertyListener(IPropertyListener listener) {
// TODO Auto-generated method stub
}
@Override
public void addPropertyListener(IPropertyListener listener) {
}
@Override
public void removePropertyListener(IPropertyListener listener) {
}
public void addPropertyListener(IPropertyListener listener) {
// TODO Auto-generated method stub
}
public void removePropertyListener(IPropertyListener listener) {
// TODO Auto-generated method stub
}